开发者

Silverlight client got NotFound error from WCF

There are a lot of article on this subject, but neither helped me. I am trying to implement service which could be used without "Add Service Ref..." mostly with advice from hhttp://www.netfxharmonics.com/2008/11/Understanding-WCF-Services-in-Silverlight-2 .

I made small project to reproduce problem. http://hotfile开发者_StackOverflow社区.com/dl/96710945/9991ac3/SilverlightApplication8.zip.html

I tried solution like :

- Handling Faults in Silverlight - Cross domain policy etc

All standard checks are done like, service is active and reachable, client succeed to create channel etc.

I am stack whole week with this problem and I can not figure it out.

Every help is appreciate.


Denis, try to create service in your web host project. Add service there and then you'll have a choice to add it as reference in your silverlight application. Just add a service in SilverlightApplication8.Web. Right click on SilverlightApplication8.Web --> Add new Item --> On left choose Silverlight --> Silverlight-enabled WCF service. And then add reference to your SilverlightApplication8.


I did not go in deeper investigation, but I assume that service implementation class type was not good.

So my factory class looked like:

Public Class TimeServiceFactory Inherits System.ServiceModel.Activation.ServiceHostFactoryBase

Public Overrides Function CreateServiceHost(ByVal constructorString As String, ByVal baseAddresses() As System.Uri) As System.ServiceModel.ServiceHostBase
     Dim host As New ServiceHost(constructorString, baseAddresses)

It needs to be changed in:

Public Class TimeServiceFactory Inherits System.ServiceModel.Activation.ServiceHostFactoryBase

Public Overrides Function CreateServiceHost(ByVal constructorString As String, ByVal baseAddresses() As System.Uri) As System.ServiceModel.ServiceHostBase
    Dim host As New ServiceHost(GetType(TimeService), baseAddresses)

Difference is I did not pass constructorString (which has information of type of service implementation class) , I passed GetType(TimeService) instate, which provided correct type information.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜