Android Addicted Apps Creator

February 12, 2013

javax.crypto.BadPaddingException: pad block corrupted

Filed under: Android — alinberce @ 12:21

 

Now, how horror does this error sound to you ? Encryption is already a very complex process and after a while when it just throws this error… well, is not very nice. This happened to me, after one of my app stopped working. If worked fine since android 2.1, but now I was getting feedback from users which ran Android 4.2 that the app has stopped responding.

Did a bit of search on http://developer.android.com/about/versions/jelly-bean.html and found out the culprit

Cryptography — Modified the default implementations of SecureRandom and Cipher.RSA to use OpenSSL. Added SSLSocket support for TLSv1.1 and TLSv1.2 using OpenSSL 1.0.1

Went in my code and found out I use using SecureRandom and Cipher:

SecureRandom rand = SecureRandom.getInstance("SHA1PRNG");

If we do a little test to see what provider does rand

get (rand.getProvider().getName()) 

we see:

  • android 4.2: AndroidOpenSSL
  • android < 4.2: Crypto

It is pretty clear that things are not ok. How do we fix this ? Actually very simple. If we look at the docs http://developer.android.com/reference/java/security/SecureRandom.html we can see that SecureRandom.getInstance() can also be called with provider parameter. 

public static SecureRandom getInstance (String algorithm, Provider provider)

So, to make our code work, we simply update it to:

SecureRandom rand = SecureRandom.getInstance( "SHA1PRNG", "Crypto" )

More info at http://android-developers.blogspot.ro/2013/02/security-enhancements-in-jelly-bean.html

September 11, 2012

Make Activity using Theme.Dialog fill the entire screen

Filed under: Tips — alinberce @ 07:55
Tags: , , ,

   Admitted, you hate using AlertDialog for complex layouts that contain many controls. I hate it, it makes me feel so limited. Of course it has its own advantages, let’s not be mean, but sometimes a new Activity unleashes the power within.

So, how do we make an Activity look like a dialog ? Simple, just add in manifest:

 <activity
            android:name=".MyDialogActivity"
             android:theme="@android:style/Theme.Dialog" />

    But the problem is, even if we set our layout properties, to fill_screen, the activity will wrap around the content and its size will vary of the info. I thought, if the xml setting is ignored, maybe setting it in code might work… and surprise, it does work. All you have to do is:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.my_dialog_layout);

    //after setContentView, set the Layout parameters to fill parent, this makes our activity to go full screen
    getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
}

August 7, 2012

Standby Touch Advanced just got released on Google Play

Filed under: Uncategorized — alinberce @ 12:24

Standby with one touch

main_featured_thumb[1]

Developer Notes

I did this project from scratch and even if on first look it seems quite simple, took me some hours to polish it. I tried to make the design as ICSish as possible. I received very good feedback on various forums about it. I use this app every day.

Technical Details

  • requires Administrator permission to perform Lock operation
  • Data, Sound and Wifi access permissions

Official description

    The app does not need any nasty permission, does not access your data, does not run all the time in background, does not use resources, does not have ads. It does just a simple thing: sends the phone to sleep as it happens when you press the Power button. I always prefer to touch a icon on the screen rather than searching for the Power button which isn’t to handy, especially if you have a bumper.

INSTALLATION NOTES
When you will install the app you will see in the Launcher two icons:
– Standby Settings – with app settings and operations.
– Standby Touch – can be added in your Home screen for convenient access which performs fast send to Standby command.

STEPS NEEDED
– First you need to Enable Admin Permission from Settings page. After your do this, the app will work as intended. Without Admin permission, it cannot perform send to standby operation.
– If you want to uninstall the app there are two ways:
a) Go to StandBy Settings and press the Uninstall button and you won’t have to worry for anything else as it will take care of the rest.
b) From Standby Settings press on the Remove Admin Permission (an android app cannot be uninstalled while it has Admin permissions enabled.) and the go to Android Apps and Uninstall the app.

With the new version I have added the possibility to use Tasks, which means you can define an interval in which the Sound/Data/Wifi (for now) are On or Off. The app will check when you press the Standby icon for tasks and update phone’s status according to them. Tasks are the reason why the app needs more permissions, but as you can see, all permissions are related to Sound, Data Connection and Wi-Fi settings. Please note that the time interval is set by rotating both circles, the inner one for the hour and the outer one for the minute.

Made for Galaxy Nexus and other large screen devices running android 4.0.1 +

Screenshot_2012-08-06-15-06-18_thumb[1] Screenshot_2012-08-06-15-06-34_thumb[1]

Screenshot_2012-08-06-15-06-44_thumb[1]Screenshot_2012-08-06-15-06-57_thumb[1]

google_play_thumb https://play.google.com/store/apps/details?id=com.alinberce.standbytouch

August 2, 2012

Tip #1 Make TableRow items of same width

Filed under: Android,Tips — alinberce @ 15:56

I usually don’t use TableLayout, but when I do I get annoyed by it. To be honest I find it way more flexible to use nested LinearLayouts as it will be easier in the future to update the design. I had this page where I needed a grid of 3×3 buttons. Of course, using LinearLayout over and over again wouldn’t have been too pleasant, so I went for the TableLayout. The curious thing was that even if I added a layout_weight=”1” for each button, in the end their width varied based on their text. After saying that TableLayout sucks… well… ergh… found the solution. Set layout_width=”0dip”. Simple yet effective.

So, to recap: if you want views from a TableRow to have the same width you need to set two properties, for each view:

 android:layout_width="0dip"
 android:layout_weight="1"

So in the end it would look something like:

 <TableLayout
       android:layout_width="fill_parent"
        android:layout_height="fill_parent"" >

        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1" >

            <Button
                android:layout_width="0dip"
                android:layout_height="fill_parent"
                android:layout_marginLeft="5dip"
                android:layout_marginRight="5dip"
                android:layout_weight="1"
                android:text="I am equal with my brother button" />

             <Button
                android:layout_width="0dip"
                android:layout_height="fill_parent"
                android:layout_marginLeft="5dip"
                android:layout_marginRight="5dip"
                android:layout_weight="1"
                android:text="I am equal with my brother button" />
        </TableRow>
...

February 20, 2012

Android EditText with custom font and clear button

Filed under: Android — alinberce @ 20:22
Tags: , , , , , ,

C’mon, admit it, you’ve always wanted this. Have you ever felt that text clearing in your android application on EditTexts feels… wrong ?

So, what do we want to achive?

Plain and simple, a TextView, based on the same principle as the previous TextView tutorial, with custom fonts (from assets folder) and with a Clear button.

image

Proceed with caution…

  Of course, if you get a request to use custom fonts in you app, this does not apply only to TextViews, but to all items like Buttons, List Items and EditTexts.

First we need to create our own custom control, extending EditText and adding the following:

  • an image resource for the Clear button
  • an TextChangedListener so we only show the Clear button when the EditText contains something
  • method for setting our custom TypeFace
  • TouchListener so we detect if the user taped on the Clear button area.

Our project will contain a few things:

image

  1. Main activity: AndroidTutorialActivity.java
  2. Our custom control: MyEditText
  3. Custom fonts in assets folder
  4. Clear_button_image resource for the button  image
  5. Main.xml as the main layout.

I’ll just post the entire code with comments and I’m sure you’ll understand it in a second:

public class MyEditText extends EditText{

	//The image we are going to use for the Clear button
	private Drawable imgCloseButton = getResources().getDrawable(R.drawable.clear_button_image);
	
	public MyEditText(Context context) {
		super(context);
		init();
	}

	public MyEditText(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		init();
	}

	public MyEditText(Context context, AttributeSet attrs) {
		super(context, attrs);
		init();
	}
	
	void init() {
		
		// Set bounds of the Clear button so it will look ok
		imgCloseButton.setBounds(0, 0, imgCloseButton.getIntrinsicWidth(), imgCloseButton.getIntrinsicHeight());

		// There may be initial text in the field, so we may need to display the  button
		handleClearButton();

		//if the Close image is displayed and the user remove his finger from the button, clear it. Otherwise do nothing
		this.setOnTouchListener(new OnTouchListener() {
			@Override
			public boolean onTouch(View v, MotionEvent event) {

				MyEditText et = MyEditText.this;

				if (et.getCompoundDrawables()[2] == null)
					return false;
				
				if (event.getAction() != MotionEvent.ACTION_UP)
					return false;
				
				if (event.getX() > et.getWidth() - et.getPaddingRight() - imgCloseButton.getIntrinsicWidth()) {
					et.setText("");
					MyEditText.this.handleClearButton();
				}
				return false;
			}
		});

		//if text changes, take care of the button
		this.addTextChangedListener(new TextWatcher() {
			@Override
			public void onTextChanged(CharSequence s, int start, int before, int count) {

				MyEditText.this.handleClearButton();
			}

			@Override
			public void afterTextChanged(Editable arg0) {
			}

			@Override
			public void beforeTextChanged(CharSequence s, int start, int count, int after) {
			}
		});
	}
	
	//intercept Typeface change and set it with our custom font
    public void setTypeface(Typeface tf, int style) {
	    if (style == Typeface.BOLD) {
	        super.setTypeface(Typeface.createFromAsset(getContext().getAssets(), "fonts/Vegur-B 0.602.otf"));
	    } else {
	        super.setTypeface(Typeface.createFromAsset(getContext().getAssets(), "fonts/Vegur-R 0.602.otf"));
	    }
    }
	
	void handleClearButton() {
		if (this.getText().toString().equals(""))
		{
			// add the clear button
			this.setCompoundDrawables(this.getCompoundDrawables()[0], this.getCompoundDrawables()[1], null, this.getCompoundDrawables()[3]);
		}
		else
		{
			//remove clear button
			this.setCompoundDrawables(this.getCompoundDrawables()[0], this.getCompoundDrawables()[1], imgCloseButton, this.getCompoundDrawables()[3]);
		}
	}
}

Don’t forget to add it in your main layout

 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <com.alinberce.app.MyEditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="My cool edit text" />
</LinearLayout>

Run it and see the result:

 

image

Source code of the project can be found: HERE

image

Are They Dead ?

Filed under: Android — alinberce @ 20:08
Tags: , , , , , , ,

Are They Dead – It’s not just an app, it’s a matter of Life & Death

image

Have you ever caught yourself wondering "Hey, are they still alive?" Well ‘Are They Dead?’ let’s you easily search for your favorite celebrities and answer that very question.

  • -View information on your favorite celebrities, including their age, birthday, the date they died and cause of death.
  • -Can’t remember the persons name? Search from films, TV shows and even bands!
  • -Search by a specific date. Find out who might have died on your birthday, or which celebrity has the same birthday as you.
  • -Search from millions of entries!
  • *(Coming Soon) Notifications! Keep track of your favorite celebrities and get notifications on their birthday, status, or the anniversary of their death. Completely customizable. Plus many more features!

 

  

 

image https://market.android.com/details?id=com.aretheydead.app

Technical details

Application uses:

  • Freebase querying via MQL language
  • JSON data parsing
  • HTTP calls
  • Custom controls with user TypeFace
  • AsyncTasks
  • Async image fetching
  • Neat Auto search with suggestions list Winking smile

January 25, 2012

Using custom fonts in android. Bold, Italic, Regular… you name it!

Filed under: Android — alinberce @ 18:22
Tags: , , , , , , ,

As time has proven me, in Android many of the things I was used to make quite easy in .net, require a lot of manual coding. Using custom fonts does not make an exception… Everything depends on what you/your client wants to have in the app.

Brief intro regarding fonts.

First take a very good look at the font license. Of course, the best fonts, the handsome and good looking ones forbid free distribution. So in case you don’t want to have any legal issues, read carefully before using a certain font. Usually fonts are of two types: OTF stands for OpenType Font and TTF stands for TrueType Font (you can take a look at http://www.differencebetween.net/technology/difference-between-ttf-and-otf/ to see the difference between them). From what I have read around the web, they say that Android supports better TTF and is recommended that in case you want to use OTF to convert it. Personally I tried the both formats and all displayed well, so it’s up to you what type to use.

Setting things up. Put your coffee on your right…

The brief was very boring I know, but it was necessary. Now let’s settle our development environment. First, we need to use a free font. I have searched for an alternative to well known Myrian Pro from Adobe and recommendations went to Vegur. You can download it from: http://www.fontspace.com/arro/vegur . Please download the archive and take a look at it…

image

What in the name of God are those names you may say (as I did). That is the font indeed, but it is split into different files. So you’ve got Vegur-B 0.602 for Bold font, Vegur-R 0.602 for regular font and so on. When you create a project for android in Eclipse, you will see a folder called assets, make in assets new folder fonts and copy these two files in it and we’re done, fonts are added in our project. So simple, eh ?

image

How on earth do I use this font in my code ?

Let’s take a quick look at how a TextView is defined in an xml file.

<TextView
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="Regular TextView no typeface"
          android:textColor="#00FF00" />

<TextView
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="Regular TextView Monospace typeface"
          android:textColor="#00FF00"
          android:typeface="monospace" />

First TextView is plain and uses the default typeface. In the second TextView things are getting a bit complex as we have android:typeface attribute set to monospace. What does this mean ? The TextView will use Monospace font to display the text. Running the app will result in this:

image

I know what you are thinking… I’ll just replace monospace with my Vegur and we are done. Well, well, well… sorry to disappoint you, but there is no way we could use our custom font as a typeface straight from xml declaration. This is not cool. So all you code writing lovers, gather around as we need to dive into the wonderful world of custom controls.

Depending on your request there are several ways to do things, so we’ll take a good look and analyze/fix each one.

1.  I want a single TextView in my activity to use this font.

Maybe you have a logo text, or maybe you have some specific portion of text you need to make more obvious. In this case the solution is simple.

First add a new TextView in the main layout

<TextView
          android:id="@+id/txtOnlyOne"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="This TextView has our custom font"
          android:textColor="#00FF00" />

Go to main activity of the project, and within onCreate add this code:

Typeface tf = Typeface.createFromAsset(this.getAssets(), "fonts/Vegur-R 0.602.otf");
TextView tv = (TextView) findViewById(R.id.txtOnlyOne)
tv.setTypeface(tf);

image

Pretty simple and direct. We create the typeface in code and assign it to desired TextView. This may seem like a good solution in this case, but what if you face 20 TextViews ? It’s not so pleasant to find each one and assign the typeface to it. You could still try to do it this way, or you could go to next point…

2. I want the whoooooooooole activity to use this font.

Well, if setting it for a TextView was so simple…  setting it to all TextViews should be the same no ? The only thing that may give us trouble, is finding all the TextViews… so, why shouldn’t we look in all views and check? Take a look at this method:

private void overrideFonts(final Context context, final View v) {
      try {
        if (v instanceof ViewGroup) {
          ViewGroup vg = (ViewGroup) v;
         
			 for (int i = 0; i < vg.getChildCount(); i++) {
           	 View child = vg.getChildAt(i);
           	 overrideFonts(context, child);
         		 }

        } else if (v instanceof TextView ) {
          ((TextView) v).setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/Vegur-R 0.602.otf"));
        }

      } catch (Exception e) {
      }
    }

Simply add this line, on activity after setContentView and see the results:

  overrideFonts(this, findViewById(android.R.id.content));

image

Wow… all TextViews look the same way, using our custom font. Good job. We should be fine, let’s go home and celebrate. But hey, what if…

3. I want the first and third TextView with bold font

Ah, piece of cake, I’ll just add android:textStyle="bold" for them and everything should be fine. Run and see the results

image

Ups… what da’… no change, it still looks the same way, where is my bold setting gone?

And now we get back to intro where we say that font file is split into several files. We need somehow to make sure that our TextView considers the textStype attribute and acts according to it. The only way to achieve this goal, in a nice manner, is to create a custom TextView and handle our typeface change in it. To keep things short, as I see you are bored, here is our extended control:

public class MyTextView extends TextView {

      public MyTextView(Context context, AttributeSet attrs, int defStyle) {
          super(context, attrs, defStyle);
      }

     public MyTextView(Context context, AttributeSet attrs) {
          super(context, attrs);
      }

     public MyTextView(Context context) {
          super(context);
     }


     public void setTypeface(Typeface tf, int style) {
           if (style == Typeface.BOLD) {
                super.setTypeface(Typeface.createFromAsset(getContext().getAssets(), "fonts/Vegur-B 0.602.otf")/*, -1*/);
            } else {
               super.setTypeface(Typeface.createFromAsset(getContext().getAssets(), "fonts/Vegur-R 0.602.otf")/*, -1*/);
            }
      }
 }

As you can see we intercept the setTypeface method, and depending of style value we assign our own custom typeface. To use it, simply add it in xml file

<com.alinberce.MyTextView
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:text="This MyTextView has our custom font"
         android:textColor="#00FF00" />

<com.alinberce.MyTextView
         android:id="@+id/txtOnlyOne"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:text="This MyTextView has our custom BOLD font"
         android:textStyle="bold"
         android:textColor="#00FF00" />

And finally we see it running and displaying the results as we wanted.

image

I personally use this as I don’t want to agglomerate my Activity code and allow me an easy way of changing the font for my entire app. You can simply put the "fonts/Vegur-B 0.602.otf" in a constant or a SharedPreference and when you change it, all you app will look different.

This post represents a resume of my questions on stackoverflow or answer found there. I just wanted to sum everything up and offer nuances of solutions based on everyone’s needs. I really hope you’ve understood it and will help you in the future. Please drop a comment if you liked it, or correct if I said something wrong.

You can find the source code of the article in this eclipse project : http://ifile.it/p0ovny3/FontsTutorial.src.zip

image

LATER EDIT: As time has proven me once again, Android is full of surprises. Using this font on Froyo/Gingerbread worked superb but on ICS… was rendered badly. The fix was quite easy: convert the OTF file to TTF using a free online font converter. Using the same font, but with TTF extension made the app look the same on all versions of Android. So kids, remember… Hate OTF, love TTF.

Compass VO for Android

Filed under: Android — alinberce @ 17:37
Tags: , , , , , ,

 

image

All you orienteering fans, gather around, I have a great announcement for you. Not an orienteering fan? No problem, after trying Compass VO along with Virtual Orienteering for Android you will be. I know what you were thinking when saw the app name “Oh boy, not another compass application”. The Android Market is full of compass applications, each having nice features and options. So, why a new one? That’s what I’ve asked the creators of the concept behind Compass VO. The answer is simple: it has some pretty neat features not found on other products that you’ll enjoy at max.

What makes Compass VO worth to try?

  • Use the popular 1, 2, 3 compass system along with this digital compass, the same as a real compass.
  • You can easily use an image of a map as a background. The image can be taken either from the phone’s Gallery or live with in-app integrated camera preview. But this is not all, after loading the map image you can manipulate it to suit your needs: rotate, zoom in and out, pan, everything is at your finger. The background remains saved and you can always update it, even after application is reopened.

image

  • Uses internal magnetic field and accelerometer sensor combined with GPS and wireless networks to offer accurate information. This allows you to choose if you want to use the magnetic heading or the true heading. All received information is available, depending on chosen theme.

image

  • Compass dial for target bearing and/or orienteering.

image

  • Multiple themes (Orienteering, Digital, Compass Rose, Mango graphics, Night, Android, many to come in the future) for each user’s taste, maybe you like a light theme or maybe a darker one… or why not the special Green robot theme

imageimageimage

  • No annoying ads, no pop-ups, no interruptions, no user spying.

I tried to keep permissions as few as possible. As you will see no “suspect” permissions like access your personal data or internet connection. So the ones that are needed are as follows:
Camera: used only on your request, with preview in order to take a photo of a map
Access fine location: used to calculate the Geographic North and offer Magnetic declination.
Wake lock: used to keep the screen on all the time. This is an option in Settings, but keep in mind that it uses a lot of battery.

      As a side note, please keep in mind that the accuracy of magnetic sensors in android powered devices is very variable. Based from manufacturer to manufacturer this can vary from pretty good accuracy to an unreliable one. You can always try to calibrate by holding the phone in front of you and moving it in a Figure-8 pattern, to see if it improves.

    Are you convinced to give it a try ? I sure hope so. Please take a look at About page in Settings. You can rate it in Android Market (5 stars please  ) or if you encounter any problems drop us an email and will do our best go fix it as fast as possible.
In the end, I must say I really enjoy working with the professional team from Just Windows Phone. Compass VO was made originally for Windows Phone Mango, carefully designed and implemented by them, and then ported by me on Android platform. I bet you wondered from what comes VO in the title? From Virtual Orienteering, this is the father project, Compass VO being a free tool to complete it. I invite you to also take a look at Virtual Orienteering community and the android application from the market.

Special thanks to:
 Virtual Orienteering – Find your way! – www.vorienteering.com

image

Just Windows Phonehttp://www.just-windows-phone.com

image

google_play https://play.google.com/store/apps/details?id=com.vorienteering.compassvo

September 17, 2010

We’re in business. VOrienteering.com is alive and kicking. You’re welcome to join our community.

Filed under: Uncategorized — alinberce @ 17:32

Hi all. It has been a really long time since I posted something in here. In past months I’ve been very busy as I switched to the Dark Side Smile, I program in java now. More precisely in Android. It is a wonderful journey for me, and I hope that in the end it will worth the time.

  A few words… well, it’s all about nature, move, sport, tracks, gps, devices, android, iphone, winmo. Just go in there, make a track and… do it with the device in real world. You know it guys don’t you… real world with trees and stuff, nature… I’m talking to you programmer Open-mouthed smile   Unfortunately the Android client isn’t ready yet, but until the end of month you’ll be able to use it with your device. Everything is free.

The web site is www.vorienteering.com . Be our next friend, register (it’s really easy to do) and provide us feedback, ideas and problems. As you can see we are in beta version.

Here are some screens of Android client:

 

image  image  image

I feel some new tutorials on Android platform coming soon Smile 

Technorati Tags: ,,,

December 23, 2009

Deploying Silverlight WCF service from developement station to IIS

Filed under: Silverlight — alinberce @ 10:52
Tags: , ,

 

The beginnings…. 

I have created a Silverlight application that uses some data taken from an almighty SQL Server. To bring data I used Silverlight enabled WCF Services. The Visual Studio solution contains the Silverlight application project and the added Web site to display the Silverlight control.  The web application contains the WCF Service and the service is referenced in the Silverlight application project.

The Solution looks like this:

SilverlightWeb – the web application, contains a folder WCFServices in which I have Service.svc

SilverlightApp – Silverlight control that references Service.svc

When I ran the solution from within Visual Studio’s internal IIS server everything works fine, I can see the SQL data in the Silverlight control.

If I try to access the .svc file from the browser accessing the http://localhost:1487/WCFServices/Service.svc I can see a page with "You have created a service.", so it’s fine.

When I was ready with milestone one of the project I decided to give it a test-drive on the IIS production server . In order to deploy the solution to the IIS Production server I took the SilverlightWeb folder and copied it on the wwwroot folder. I created a Virtual Directory for SilverlightWeb folder. The .svc extension appears to be registered on the IIS. Before deploying I also modified the ServiceReferences.ClientConfig file, setting the endpoint address from

endpoint address="http://localhost:1487/WCFServices/Service.svc&quot;

to

endpoint address="http://IIS Server’s IP address/WCFServices/Service.svc"

When I try to access from browser (http://IIS Server’s IP address/SilverlightWeb/TestPage.html), I can see the silverlight control, but when I press the button that calls the WCF Service nothing happens.

I tried to access the WCF service directly to see: http://IIS Server’s IP address/WCFServices/Service.svc  and gives me a File not found error

If I access using http://IIS Server’s IP address/SilverlightWeb/WCFServices/Service.svc I get a window where it says

<%@ ServiceHost Language="C#" Debug="true" Service="SilverligtWeb.WCFServices.Service" CodeBehind="Service.svc.cs" %>
 

The cursing…

In order to make the solution work on IIS I did everything I could find over the Google. I was really pissed off because WCF seemed such a fine concept but I couldn’t use it. It took me almost one week to find the answers… the good thing is that meanwhile I had other things to think about, rather than cursing. I have a straight rule: if it isn’t broken, don’t break it. Of course, the IIS server was fully used by a bunch of final users and I couldn’t risk making all kind of trial and error on it in order to make WCF service work. So, I made a full Backup and restore it on on PC. After all the hassle of restoring the image, driver install, network configuration… when everything was ready (took me 2 days) in 5 minutes I got the solution working. As my good friend, Emanuel said: It’s probably a 2 minute thing. Well, it was a simple thing. Emanuel also recommended me a great piece of software: Fiddler2. It is very useful to see what connections are being made from the browser, as it acts like a proxy between the browser and the network.

The solution…

Three baby steps were needed in order to solve the issue:

1.  Make sure that .Net 3 or 3.5 is installed on the IIS

2. Configure the IIS metabase to pass .svc files to ASP.NET and then on the WCF. The .svc was handled as static content.

Thank you Richard Blewett for these two steps.

3. A final step would be modifying the endpoint address (again) to be correct. When in Visual Studio internal IIS, there was no virtual directory created in order to run the project locally. When I deploy it on IIS I made a virtual directory so the endpoint address should be updated in order to have the correct path to .svc file.

endpoint address="http://IIS Server’s IP address/WCFServices/Service.svc"

to

endpoint address="http://IIS Server’s IP address/VirtualDirectoryMadeForSolution/WCFServices/Service.svc"

If still doesn’t work, please check to see if .svc extension is registered. If no, manually register it.

Well that’s all. I had to learn a little Silverlight. It is indeed a great technology that allowed me to make thing I could even think possible in a browser.

Next Page »

Create a free website or blog at WordPress.com.