Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Silverlight Client and WCF Service - System.ServiceModel.ProtocolException-UnexpectedHttpResponseCode
8 replies. Latest Post by codism on May 5, 2008.
(0)
bscc
Member
6 points
5 Posts
03-24-2008 11:04 AM |
I am new to WCF as well as SilverLight, getting the this .Exception ..
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=2.0.30226.2&File=System.ServiceModel.dll&Key=UnexpectedHttpResponseCode
1. WCF Service - a hosted service in IIS5.1-Windows XP Professional and details as follows.. http://host/RoleService Binding : basicHttpBinding Contract: IRoleService Operations: -GetRole -GetRoles -Greet 2. SilverLight client with ServiceReference for endpoint http://host/RoleService/Service1.svc. In the client program it says IClientChannel is open , but System.ServiceModel.CommunicationException is the result of call on RoleService.GreetAsync("Name").
crossdomain.xml
<?xml version="1.0"?><!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"><cross-domain-policy> <allow-access-from domain="*" secure="false"/></cross-domain-policy>
clientaccesspolicy.xml
<?xml version="1.0" encoding="utf-8"?><access-policy> <cross-domain-access> <policy> <allow-from> <domain uri="*"/> </allow-from> <grant-to> <resource path="/" include-subpaths="true"/> </grant-to> </policy> </cross-domain-access></access-policy>
Already spent lot of time , I could not spend any of this much time on Java based services donno for what ever reasons, still no luck with Silverlight. Thankful if you Silverlight gurus help me out..Thanks and Regards, BS
bradtpm
54 points
15 Posts
03-25-2008 7:58 PM |
I don't have much info on an answer, but maybe this will help you go in the right direction. Your error messages are general and you can view the real ones by installing Silverlight 2 SDK Beta 1, and following the instructions here:
http://www.microsoft.com/silverlight/resources/readme.aspx
For some reason the error messages are general and are not working by default. (I did this today and it helped with debugging WCF)
brad
Allen Ch...
Star
13635 points
1,777 Posts
03-25-2008 11:35 PM |
Hi:
Where do you put the policy file? C:\Inetpub\wwwroot?
I suggest you to put WCF and Silverlight in the same domain to test. If it can work we can target it as cross domain issue.
Regards
03-26-2008 12:28 AM |
Thank you very much for the information.
First I started with Visual Studio 2005 .NET Framework 2.0
First Phase-1
-----------------
-Installed 3.0
-Ajax
-ASP.NET Futures
First Phase-2
------------------
Visual Studio 2008 and Silverlight tools for VS2008 , I am not sure Silverlight 2 SDK Beta 1 co-exists with the one already there, but why the error messages are not customized for the installation I have.....is a question to me.
Thanks and Regards,
BS
hpwillbe
28 points
18 Posts
04-04-2008 2:44 PM |
I am getting the same error.. I also have clientaccesspolicy file in place although I don't see a reason why I should because everything is running on the same domain. (localhost:port). I believe the request never reaches the server as I have breakpoints all over and none of them gets hit. Not sure what is going on.. will work on a Windows app to call the same service and see if that works and post it here soon.
04-04-2008 4:30 PM |
Ok.. I found the issue and the solution to it.
The issue is when you add a WCF service in your asp.net web project it by default adds the wsHttpBinding as a default configuration. Now looks like the Silverlight does not have WSHttpBinding implemented yet so I was using BasicHttpBinding on the client side. WSHttpBinding uses SOAP 1.2 while BasicHttpBinding uses SOAP 1.1 & hence the protocol exception. The solution as you might guess is to change your web.config to have binding="basicHttoBinding" -> refresh the service ref in SL project and you are good to go..
I must say the error message from given by Silverlight was not much help. I had to do a winforms app to figure out the issue. Related winforms thread http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1237025&SiteID=1
So here's the question. I know wsHttpBinding gives you all sorts of bells and whistles with it.. specially around security. How do we deal with that now with Silverlight clients??
hope that helps,
Harshit
Carlos63
4 points
12 Posts
04-10-2008 3:08 PM |
You had me excited there for a second, but it turns out that although I am having a similar problem, I had already set it up to use basic binding.
Here is the error:
A first chance exception of type 'System.ServiceModel.ProtocolException' occurred in System.ServiceModel.dll
Additional information: [UnexpectedHttpResponseCode]
Arguments:Not Found
I've been working on this on an off since beta 2 release.
Here is my service model config on the wcf host:
<
</
Here it is on the silverlight host:
SionnachRoe
9 Posts
04-28-2008 7:10 AM |
Have a look at
http://timheuer.com/blog/archive/2008/04/09/silverlight-cannot-access-web-service.aspx
HTH,
Alan.
codism
372 points
121 Posts
05-05-2008 5:14 PM |
I think my experience may be helpful to someone: the message "UnexpectedHttpResponseCode" is very misleading. In my case, my service is trying to access database by myserver\ASPNET user. Once I setup a login for my service in the database, the application runs without problem.