Asp.Net: invoke WCF method with WCF Test Client

When deploying a Silverlight application we ran into problems a WCF web-service, to find out what the problem was I wanted to invoke the method.

Microsoft shipped an application for invoking methods from your Windows PC (WCFtestclient.exe). The following steps explain how to use WCFtestclient.exe.

First startup Visual Studio 2008 Command Prompt. In the command prompt type wcftestclient, the application will startup.

Now we need to add the Service. Click File and Add Service.

 

Add the URL to your service in the pop-up and pres ok. The service will now add all methods from your service. You can add multiple service URLs.

Double click the method you want to invoke from the tree on the left pane. Enter the values that are required for the Invoke and press Invoke. The method will be invoked.

The right bottom pane will show the response. In my case this shows the Stack-trace because of the error. Normally this will show the web-service response (XML).

With the stack-trace I could located the error and fix it.

Hope this helps,

Pieter

WCF webservice error with DBML objects

When deploying a WCF webservice for a Silverligh application I got the following error:


An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.InvalidOperationException: An exception was thrown in a call to a WSDL export extension: System.ServiceModel.Description.DataContractSerializerOperationBehavior
 contract: <a href="http://tempuri.org/:IWebService">http://tempuri.org/:IWebService</a> ----&gt; System.Runtime.Serialization.InvalidDataContractException: Type 'Project.service.HU_BACH.ScPlacemark' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.


As you can see from the error you need to add the [Serializable] attribute to all objects that are used within the webservice. After I did this I got the same error for my Linq to Sql objects generated within my DBML. You can make your Linq to Sql objects serializable by changing the dbml setting Serialization Mode to Unidirectional.

 
Hope it helps.

Silverlight: Add .xap as MIME Type to IIS

When I tried to run a my Silverlight App on IIS7 I got the following error:

[code:html]

Microsoft JScript runtime error: Sys.InvalidOperationException: InitializeError error #2104 in control 'Xaml1': Could not download the Silverlight application. Check web server settings

[/code]


The solution for this problem is adding .XAP file extension to your IIS MIME Types. The MIME type is application/x-silverlight-app.

If you don't know what a MIME Type is read this post.

Silverlight Alpha 1.1 VS 2008 add in

I
just tried to install the VS2008 SilverlightTools Alpha, but I
immediatly ran in to an error. The installation couldn’t start beacause
VS2008 was not installed. This suprised me because I just installed
thirty minutes before. A some searching I found out that I needed to
install the Visual Web Developer.

You can install this by running the VS2008 setup again an choose to add features. Now the Silverlight tools setup runs flawless.