Simple WCF Webservice Call from Silverlight (Need Help Please!) -


I am new to Silverlight programming and networking in general and I am trying to find the answer throughout the day. I am trying to create a very simple Silverlight4 Web application in VS2010 which makes a webservice call on the ASP.NET website (should not the exact solution like Silverlight Client app be any cross-domain issues?).

I have written the service, which I have consumed in the Silverlight service:

Public Menopause () {InitializeComponent ();

TestServiceClient Proxy = New TestServiceClient (); EndpointAddress address = New EndpointAddress ("http: // localhost:" + HtmlPage.Document.DocumentUri.Port + "/SilverlightApplication1.web/TestService.svc"); Proxy Endpoint Address = address; Proxy GetStringCompleted + = New Event Handler & lt; GetStringCompletedEventArgs & gt; (Proxy_tatestring); Proxy.GetStringAsync (); } Void proxy_GetStringCompleted (Object Sender, GetStringCompletedEventArgs E) {MessageBox.Show (e.Result.ToString ()); }

It works very well when I run it from VS2010 However, when I publish it on my personal webserver (IIS 7) on the same computer, Error:

Webpage Error Details

User Agent: Mozilla / 4.0 (compatible; MSIE 8.0; Windows NT 6.1, Trident / 4.0; SLCC2; .NET CLR 2.0.50727, .NET CLR 3.5.30729, .NET CLR 3.0.30729, Media Center PC 6.0; OfficeLiveConnector.1.4; OfficeLivePatch.1.3; .NET4.0C; .NET4.0E) Timestamp: Mon, 17 May 2010 08:29:51 UTC

Message: COB An exception occurred during the unchecked error operation in the lightlight application, which resulted in invalidation. Check the inner exception for the exception details. 1 Four: On (SystemkComponentModelkAsyncCompletedEventArgskRaiseExceptionIfNecessary on SilverlightApplication1.TestServiceReference1.GetStringCompletedEventArgs.get_Result on SilverlightApplicationlkMainPagekproxy_GetStringCompleted SilverlightApplicationlkTestServiceReferencelkTestServiceClientkOnGetStringCompleted ()) (object sender, GetStringCompletedEventArgs e) (object state) on the line: 1 Code: 0 URI:

When I catch an exception in App.xaml.cs, I get the following message:

System. Unknown Operation exception: Eval failed. On system.Windows.Browser.HtmlWindow.Eval (string code) SilverlightApplication1.App.ReportErrorToDOM (ApplicationUnhandledExceptionEventArgsE)

I should mention that the web server seems otherwise working properly. I can host Silverlight Access through port 8001 without any problems. For my life I can not imagine making a successful webservice call! Any help with this would be greatly appreciated. I have wasted it on a whole afternoon and evening. My mind is just slipping into the bustle ...: - (

Many, thank you very much in advance! Fortune

PS apologized for cross-posting in the Silverlight forum but there Some problems were posting.

I do not think that it really is to do with web service calls because The exception has been caught in App.cs to say something about "eval has failed." I could have code in my proxy_getStringCompleted handler It seems that MessageBox.Show. Maybe you are using JavaScript blocker for a browser, behind the scenes, there is nothing more than a JavaScript alert and active or any kind of like, what you trying to do Just use something from MessageBox.Show (), like

  (New ChildWindow {Content = New TextBlock {text = e.Result. ToString ()}}). Show ();  

.

Cheers, Alex


Comments