An Original Idea

because all great software begins with an original idea

Problem calling a Web Service from Silverlight 2

Posted by anoriginalidea on May 31, 2008

image

Apparently the “System.ServiceModel.ProtocolException” error is common in the fledgling world of Silverlight 2 and Web Services.

 

In my case I tried to reference a Web Service that my company created and was disappointed with this entertaining message:

 

System.ServiceModel.ProtocolException’ occurred in System.ServiceModel.dll but was not handled in user code Additional information: [UnexpectedHttpResponseCode]Arguments:Not Found
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

 

What this meant in my case is that I needed a “crossdomain.xml” file placed in the root folder of the server I was accessing.

 

For a development server, this could mean something like this:

<?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="*" />
</cross-domain-policy>

 

This gives all applications (Silverlight, Flash) no matter where they’re from to access any web applicaitons on your web host.

 

As an ISV I find this a bit annoying, as it means updating a file that is outside of the Web Application (in the Web Root).

 

It would be nice to be able to configure this information within the virtual directory of the application itself.

 

 

Links

One Response to “Problem calling a Web Service from Silverlight 2”

  1. [...] Web Services in SLRunning into an ProtocolException using web services?  Check this out:http://anoriginalidea.wordpress.com/2008/05/31/problem-calling-a-web-service-from-silverlight-2/Top 10 Silverlight Real World ImplementationsHard Rock Cafe MemorabiliaNBC Beijing OlympicsMicrosoft [...]

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>