I am attempting to add a json endpoint to an existing WCF RIA Silverlight servive using the info found here:
However when I launch the project in debug I get a
The remote server returned an error: NotFound.
error in Silverlight.
The WCF Trace says:
System.ServiceModel.ServiceActivationException: The service
‘/Services/CTCT-KronosNameManagement-Web-Services-BPAuthenticationDomainService.svc’
cannot be activated due to an exception during compilation. The
exception message is: Could not load file or assembly
‘Microsoft.ServiceModel.DomainServices.Hosting, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its
dependencies. The system cannot find the file specified.. —>
System.IO.FileNotFoundException: Could not load file or assembly
‘Microsoft.ServiceModel.DomainServices.Hosting, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its
dependencies. The system cannot find the file specified. at
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean
throwOnError, Boolean ignoreCase, Boolean reflectionOnly,
StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean
loadTypeFromPartialName, ObjectHandleOnStack type) at
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean
throwOnError, Boolean ignoreCase, Boolean reflectionOnly,
StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean
loadTypeFromPartialName) at System.RuntimeType.GetType(String
typeName, Boolean throwOnError, Boolean ignoreCase, Boolean
reflectionOnly, StackCrawlMark& stackMark) at
System.Type.GetType(String typeName, Boolean throwOnError) at
System.ServiceModel.DomainServices.Hosting.DomainServiceHost.CreateEndpointFactoryInstance(ProviderSettings
provider) at
System.ServiceModel.DomainServices.Hosting.DomainServiceHost.CreateDescription(IDictionary`2&
implementedContracts) at
System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection
baseAddresses) at
System.ServiceModel.ServiceHost.InitializeDescription(Type
serviceType, UriSchemeKeyedCollection baseAddresses) at
System.ServiceModel.DomainServices.Hosting.DomainServiceHost..ctor(Type
domainServiceType, Uri[] baseAddresses) at
System.ServiceModel.DomainServices.Hosting.DomainServiceHostFactory.CreateServiceHost(Type
serviceType, Uri[] baseAddresses) at
System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String
constructorString, Uri[] baseAddresses) at
System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String
normalizedVirtualPath, EventTraceActivity eventTraceActivity) at
System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(ServiceActivationInfo
serviceActivationInfo, EventTraceActivity eventTraceActivity) at
System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String
normalizedVirtualPath, EventTraceActivity eventTraceActivity) —
End of inner exception stack trace —
If I remove the endpoint in the web config, boom: it works again… Except for the json of course.
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<domainServices>
<endpoints>
<add name="JSON" type="Microsoft.ServiceModel.DomainServices.Hosting.JsonEndpointFactory, Microsoft.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</endpoints>
</domainServices>
</system.serviceModel>
I do have the WCF Ria Services Toolkit installed. The System.ServiceModel.DomainServices.Hosting.dll version is 4.1.61829.0
Any suggestions would be very helpful.
Even though Deepesh stated clearly that you needed to add a reference to
Microsoft.ServiceModel.DomainServices.Hosting.dllin the write up, I don’t think this was mentioned in the video and when I was troubleshooting I saw that I had a reference toSystem.ServiceModel.DomainServices.Hosting.dlland did not notice the differnece betweent he two DLLs. Adding a reference to the first fixed everything.