Showing posts with label fix. Show all posts
Showing posts with label fix. Show all posts

Monday, July 21, 2008

Setting up WCF web service

While setting up a new project I ran into the following issue with a WCF web service that needed to pass data to a silverlight application.



The type of errors I was recieving:

Content Type application/soap+xml; charset=utf-8 was not supported by service


System.InvalidOperationException: An exception was thrown in a call to a WSDL export extension: System.ServiceModel.Description.DataContractSerializerOperationBehavior contract: CubeService ----> System.Runtime.Serialization.InvalidDataContractException: Type 'GraphDataClass' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.


The problem is with the class contracts not matching and being unable to be serialized (or something along that effect)

Start by including
Imports System.Runtime.Serialization
-for examples [http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datamemberattribute.aspx]

Give the class and properties the according contract information (See image below or example above)



That should allow you to add the WCF as a web service reference/fix the errors. Comment if you have questions on it, because I'm just briefly going over the problem/solution.

Friday, July 18, 2008

Silverlight: Beware of the Contract

WCF webservice in a silverlight project debugging.


Project build will succeed with 1 warning:

Warning 1 Custom tool warning: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.


This warning refers to the file Reference.svcmap Line 1 Column 1.


When you do run the project you will get:

The remote server returned an unexpected response: (404) Not Found.


This is a pretty good indicator that the web service is not being found. Why? It's looking in the wrong place of course. This is the second time that ServiceReferences.ClientConfig has caused me problems. The solution to resolve the above errors is to simply open up the ServiceReferences.ClientConfig in you Silverlight application, and point the to the correct location of your webservice. Last time I had my project open, the service was running on port 1786, now the port changed to 1408, thus an entirely different location.



Another place to look is under the Web.config file in the website project. Look for all the endpoint addresses, and check to make sure they are correct.
Hope this post helps your debug! Cheers

Tuesday, April 08, 2008

Vista Profile Service

A post that may be of use to someone on the internet:
Currently I am working on a Dell Inspiron 1501 laptop with Vista. Scrolling through the event viewer while in Safe Mode, it appears that the User Profile could not be loaded so it loaded a temporary profile. The next login, however, Vista was unable to load the user profile. In fact, it started throwing a
"The User Profile Service service failed the logon. The UserProfile failed to load."

The best fix is to use the System Restore. I restored the computer back to the lastest restore point, and the computer logs in normally. Complete instructions follow:

1. Turn on computer
2. Press F8 until you get a menu with System Recovery/Safe Mode/Safe Mode with...
3. Select Safe Mode
4. Login with the user account. This solution assumes you are able to login to your account through safe mode.
5. Start All Programs Accessories System Tools System Restore
6. Restore your computer to an earlier point. Your computer will reboot and you should be able to login now.
7. Success! Celebrate with a can of Mountain Dew or something...

Another option (basically the same as above but using a different means). I used the method above, but I presume that this approach will accomplish the same task.
1. Turn on computer
2. Press F8 until you get a menu with System Recovery/Safe Mode/Safe Mode with...
3. Select the System Recovery Mode
4. Login with an admin user account. This solution also assumes you are able to login.
5. A menu is displayed with a couple options:
a) You can try to automatically detect and fix any problems (this most likely will only help if you have driver issues during boot up).
b) Select System Recovery. <-
6. Restore your computer to an earlier point. Your computer will reboot and you should be able to login now.
7. Success! Celebrate with a can of Mountain Dew or something...

At last! I hope this post helps you in a time of trouble.

cheers