Skip to main content
Home Forums General Silverlight Hosting and Streaming Webservice (.asmx) not working on IIS
5 replies. Latest Post by alok572 on June 19, 2009.
(0)
piscevs
Member
44 points
49 Posts
06-16-2009 8:10 AM |
Hello!
When the project runs on debuging mode, it's working fine. I'm just pushing silverlight button which calls "hello world" method from Webservice.asmx.
But when i'm trying to call push button while project runs from IIS, it causes error :
Webpage error detailsMessage: Unhandled Error in Silverlight 2 Application An exception occurred during the operation, making the result invalid. Check InnerException for exception details. at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() at SilverlightApplication1.myRef.HelloWorldCompletedEventArgs.get_Result() at SilverlightApplication1.Page.proxy_HelloWorldCompleted(Object sender, imageeeeeesCompletedEventArgs e) at SilverlightApplication1.myRef.WebService1SoapClient.OnHelloWorldCompleted(Object state)Line: 1Char: 1Code: 0URI: http://localhost/new/SilverlightApplication1.Web/Main.aspx
Here is my silverlight codebehind and webservice code screeshot:
http://img8.imageshack.us/img8/6194/webk.gif
and some web.Config code:
<bindings> <basicHttpBinding> <binding name="WebService1Soap" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://localhost:2782/WebService1.asmx" binding="basicHttpBinding" bindingConfiguration="WebService1Soap" contract="myRef.WebService1Soap" name="WebService1Soap" /> </client> </system.serviceModel>
I even cant imagine where is the problem.
Thanks!
clint1222
Participant
1426 points
198 Posts
06-16-2009 11:37 PM |
Hi piscevs,
It’s probably an address issue. You’re using the default address when you create your web service client. The Silverlight app will get the default address from the ClientConfig file. Take a look at the ClientConfig file inside the xap file. Either update the ClientConfig file in a text editor; or update the service reference to point to the IIS web service and rebuilt the project and deploy the new .xap file; or dynamically build the address based on the Host information.
You should update the endpoint address inside the client element in the web.config.
Also keep in mind that if you use localhost in your address references, the web service calls from your Silverlight app will only work on the machine hosting IIS. Use the domain name or machine name.
In your completed method test and check for an error message.
If you’re still getting an error, post the returned error message.
06-17-2009 7:27 AM |
Recently found an asnwer here
Now i'm using
var proxy = new myRef.WebService1SoapClient("WebService1Soap", "http://localhost/ddd/SilverlightApplication1.Web/WebService1.asmx");
if i run project from IISand
var proxy = new myRef.WebService1SoapClient("WebService1Soap", "http://localhost:2782/WebService1.asmx");
if i run from Visual Studio
instead of using
myRef.WebService1SoapClient proxy = new SilverlightApplication1.myRef.WebService1SoapClient();
SoapClient just need a web services actual path
06-18-2009 8:04 PM |
Hi,
Yes the client needs the address to the service. When you used the default constructor in new SilverlightApplication1.myRef.WebService1SoapClient(), the address came from the ClientConfig file. When you set up the site in IIS, the web service call was still to http://localhost:2782/WebService1.asmx, which has two potential problems. One it the service may not be up and running since it's using the development server. It's also a cross domain call at that point and would require a clientaccesspolicy file or a crossdomain policy file in place to be successful.
You can still type the proxy variable as myRef.WebService1SoapClient. Not sure why you changed to a variant.
If you're going to access the Silverlight App from a browser that's not running on the host machine, you'll get an error. You still need to update the web reference from "localhost" to the machingname or domain name.
alok572
334 points
63 Posts
06-19-2009 3:03 AM |
Hi Piscevs,
I had faced the same problem before. You must be copying the application to your IIS or you maybe creating one in it, right.
Instead of doing that, Just through your solution explorer, publish your website. This will change the settings in your web.config or serviceclient.config file.
Publish your website on your IIS, thats it.
Mark as answer if i've helped you.
06-19-2009 3:09 AM |