DomainOperationException when loading entities via Domain Service (WCF RIA)

1.5k views Asked by At

I have a simple Silverlight project that is just getting a set of entities (EF 4) on an IIS 7.5 system. Here is my web config:

<configuration>
  <system.webServer>
    <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>
    <validation validateIntegratedModeConfiguration="false" />
  </system.webServer>
  <system.web>
    <httpModules>
      <add name="DomainServiceModule" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    </httpModules>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </assemblies>
    </compilation>
  </system.web>
  <connectionStrings>
    <add name="BusinessProcessEntities" connectionString="metadata=res://*/ForecastModel.csdl|res://*/ForecastModel.ssdl|res://*/ForecastModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=usd-ctct-app-01.mydomain.net;Initial Catalog=BusinessProcess;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
</configuration>

When I browse to http://forecasting.mydomain.net/ClientBin/ForecastTool_2-Web-ForecastDomainSvc.svc?wsdl I see the service web page. Fiddler has given me nothing to really go on. SQL Profiler does not show the query hitting the DB server. As you would expect, everything works briliantly with Cassini. Here is a show of the popup message I get for the error. Just not sure what I have done wrong here. I feel this should be simpler than it is right now...

Error Dialog

1

There are 1 answers

0
Robert Kaucher On BEST ANSWER

I added <identity impersonate="false" /> to the web.config and I am using [RequiresRole()] to limit access to the methods as required. Not sure why I was having such a hard time with this. It is basically what I would have done in regular WCF.