Skip to main content

Microsoft Silverlight

Unanswered Question Sorry, another WCF hosting problem!RSS Feed

(0)

moonlit_valley
moonlit_...

Member

Member

1 points

13 Posts

Sorry, another WCF hosting problem!

Sorry in advance, I know this question has been asked a plenty, but my brain is fried trying to figure this how this should be put together. I've tried so many suggestions in the forums and articles, but to no avail.

I'm getting the parse error: The CLR Type 'ClimateRisk.Web.SuburbService.SuburbServiceFactory' could not be loaded during service compilation.

<%@ ServiceHost Language="VB" Debug="true" Service="ClimateRisk.Web.SuburbService" CodeBehind="SuburbService.svc.vb" Factory="ClimateRisk.Web.SuburbService.SuburbServiceFactory" %>

I have create a solution called climateRisk, and a SL enabled WCF service that resides in the root of the climateRisk.Web project (not in a App_Code folder). The service is called SuburbService.svc. The solution works fine when served from within Visual Studio using it's internal webserver. Before publishing the solution, I put the following Factory code in SuburbService.svc.vb under the class the holds the OperationContract.

Public Class SuburbServiceFactory

Inherits ServiceHostFactory

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

Return MyBase.CreateServiceHost(constructorString, baseAddresses)

End Function

Protected Overrides Function CreateServiceHost(ByVal serviceType As System.Type, ByVal baseAddresses() As System.Uri) As System.ServiceModel.ServiceHost

Dim webServiceAddress = New Uri("http://myhostingurl/SuburbService.svc")

Dim webServiceHost = New SuburbServiceHost(serviceType, webServiceAddress)

Return webServiceHost

End Function End Class

Public Class SuburbServiceHost

Inherits ServiceHost

Public Sub New(ByVal serviceType As Type, ByVal baseAddresses As Uri)

End Sub

Protected Overrides Sub ApplyConfiguration()

MyBase.ApplyConfiguration()

End Sub

Is this the right place to put this code?

When I publish it, I notice that the SuburbService.svc.vb file is no where to be seen. Nor is there a App_Code.dll. Is this the problem? Or is the code placed in the solution dll, CLimateRisk.dll file? I tried manually placing the SuburbService.svc.vb file in the root directory on the hosting site (as it is on my local machine), but this did not work.

Some posts and articles are saying that a new website should be created with a new WCF service and this should be published seperately? I tried this, and Service.vb and IService.vb are produced. How do these relate to my original SuburbService code? Do I copy code from one service to another? It seems odd, that I need to do this big extra step, when it appears to work as it is from with Visual Studio.

I have also tried all of the following in the Markup, as so many posts have different offerings:

Factory="SuburbServiceFactory

Factory="SuburbService.SuburbServiceFactory

Factory="ClimateRisk.Web.SuburbService.SuburbServiceFactory

Any help would be greatly appreciated.

Drew

ken tucker
ken tucker

All-Star

All-Star

16324 points

2,493 Posts

Re: Sorry, another WCF hosting problem!

 If you publish a web site it will precompile all the code in the app_code folder and put it in a file named precompiled.web.  You would not see a file named app_code.dll. You should not copy the vb file to the spot your hosting your website if you publish it.  

 

 

 

 

moonlit_valley
moonlit_...

Member

Member

1 points

13 Posts

Re: Re: Sorry, another WCF hosting problem!

And there's no need to create a seperate Web Service Project (as described here http://blogs.msdn.com/nikola/archive/2008/03/12/visual-studio-2008-walkthrough-creating-hosting-and-using-wcf-services-with-silverlight-2-beta-1.aspx), if it's already working locally?

ken tucker
ken tucker

All-Star

All-Star

16324 points

2,493 Posts

Re: Re: Sorry, another WCF hosting problem!

When I create a silverlight project I have it create the web application at the same time. I put my services in there.

moonlit_valley
moonlit_...

Member

Member

1 points

13 Posts

Re: Re: Sorry, another WCF hosting problem!

ken tucker:

When I create a silverlight project I have it create the web application at the same time. I put my services in there.

Thanks, I've stuck with that, and this has taken me to a new message:

InitializeRuntime requires that the Description property be initialized. Either provide a valid ServiceDescription in the CreateDescription method or override the InitializeRuntime method to provide an alternative implementation.

Can anyone one clarify what this means?

Thank you

Drew

 

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities