Koen
Koen

Reputation: 3683

RIA Services error but not used

I created an ASP.NET MVC WebPages application. Works perfectly local. Works perfectly on the server when I install it as a website. However when it is installed as an IIS application (level below another website, using the same application pool) all it does is throwing this exception:

Could not load file or assembly 'System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Apparently something related to WCF RIA services, which is not used. All I use is Linq to SQL. How is this possible?

Server: Windows Server 2008 R2 with IIS 7.5

Upvotes: 1

Views: 595

Answers (2)

Gendolph
Gendolph

Reputation: 473

I know it too late, but may be my answer will be useful for some people. I had similar problem, but no corresponded to IIS.

So, I had web app based on RIA services. This app used separate dll (DAL) which contained some classes attributed by RIA attributes (of course, it had reference to RIA dll). The dll (DAL) was referenced by another app which did not use RIA and raised same error as you mentioned (but only with System.ServiceModel.DomainServices.Server). This error was raised only during WCF channel creation (ChannelFactory<>). So I suppose WCF should know about all referenced dlls during analyzing of attributes of contract's classes. But I did not found any explanation why WCF don't used only own attributes whithout analizing all of them.

Upvotes: 0

Jehof
Jehof

Reputation: 35544

Check the web.config of your application if it contains an entry like:

<httpModules>
  <add name="DomainServiceModule"
       type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</httpModules>

It is located in the <system.web> section.

Theres is also another entry like:

<modules runAllManagedModulesForAllRequests="true">
  <add name="DomainServiceModule" 
       preCondition="managedHandler"
       type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</modules>

in the <system.webserver> section.

Remove the entries, then you should not get the exception.

Upvotes: 2

Related Questions