开发者

Error hosting Silverlight application page with WCF service

开发者 https://www.devze.com 2023-02-16 16:59 出处:网络
I am currently developing a Silverlight application with WCF service. The process flow of my project is as follows.

I am currently developing a Silverlight application with WCF service. The process flow of my project is as follows.

Silverlight page -> Service1.svc -> SQL Server 2008 and back

What my Silverligth page does is when a user clicks a button it calls a service reference (Service.svc). What the service is doing basically is to query a SQL database (SQL server 2008) and return the query back to the service and in turn the service returns the result back to the Silverlight page where it will be displayed.

When I am debugging and running the webpage from the visual Studio 2010 express all the things go according to plan i.e. when the user clicks the button the data that were acquired from the database are displayed.

But when I try to publish this and run it on Apache server or IIS I am getting an error when clicking the button. The web page is displayed correctly even from another internally connected PC, but the problem occurs when I press the button.

An error message is displayed as shown below:

An exception occurred during the operation, making the result invalid. Check InnerException for exception details.
at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at SilverlightApplication11.S开发者_StackOverflow社区erviceReference1.DoWorkCompletedEventArgs.get_Result()
at SilverlightApplication11.About.client_DoWorkCompleted(Object sender, DoWorkCompletedEventArgs e)
at SilverlightApplication11.ServiceReference1.Service1Client.OnDoWorkCompleted(Object state)

-------------------------------->

I have abosolutley no idea on how to solve this. I am very new to this whole stuff please help I been stuck in this about a week now.

Any snippets of code you guys would like please comment so I can post it here.

Thanks in advance =)


The service call you're making has an equivalent event to tap into. Your handler will be called when the operation completes or fails. The event args passed to your handler will contain information about your error. Keep digging into inner exception until something makes sense.

Also, your silverlight's App.xaml.cs has the ability to do something when an exception is thrown. There's an event called UnhandledException you can tap into. From there, you can output more information for yourself about the InnerException. Sometimes the first exception is not helpful, but there will be an InnerException in the Exception that will have more detail.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号