开发者

WCF RIA gives EndpointNotFoundException in Azure when accessing with WP7

开发者 https://www.devze.com 2023-04-11 21:07 出处:网络
I\'ve been fighting a problem with a WCF RIA Domainservice the whole day long. I\'m writing a WCF RIA Service Library, which is deployed on Windows Azure. I access it via a Silverlight and a Windows

I've been fighting a problem with a WCF RIA Domainservice the whole day long.

I'm writing a WCF RIA Service Library, which is deployed on Windows Azure. I access it via a Silverlight and a Windows Phone 7 Client. I have two ASP.NET-Projects as two Web Roles in my Cloud application, which act as two different End Points.

The first one provides access via SSL for the Silverlight Client.

The second one is a simple endpoint, without authentication for the WP7 Client. It runs on port 8080.

On my local cassini everything works fine. I can access the service with both clients. In the cloud I can only use the Silverlight Client. When I try to reach the service with the WP7 App I get:

System.ServiceModel.EndpointNotFoundException wurde nicht behandelt. Message=There was no endpoint listening at http://myapp.cloudapp.net:8080/Services/MyRIAServiceLib-Web-MyService.svc/soap that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

The Inner Exception is of type System.Net.WebException and says:

The remote server returned and error: NotFound

I added a automated ServiceReference to my WP7 App to get connected to the WCF Service. When I do so, VS2010 successfully recognizes the Service and generates the code to make it usable. This must mean the service is available and can be found, right? When I go to http://myapp.cloudapp.net:8080/MyRIAServiceLib-Web-MyService.svc by browser I can see the usual "You have created a service."-Page.

I have added all dlls as local copies set to true, which could be missing in the cloud, but maybe I missed some. My web.config looks like this:

<configSections>
  <sectionGroup name="system.serviceModel">
    <section name="domainServices" type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  </sectionGroup>
</configSections>
<system.serviceModel>     
<domainServices>
  <endpoints>
    <add name="soap" type="Microsoft.ServiceModel.DomainServices.Hosting.SoapXmlEndpointFact开发者_C百科ory, Microsoft.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </endpoints>
</domainServices>  
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"    multipleSiteBindingsEnabled="true" />
</system.serviceModel> 
<system.webServer>
 <validation validateIntegratedModeConfiguration="false" />
   <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>
 </system.webServer>
 <system.web>
   <customErrors mode="Off"/> 
   <compilation debug="true" strict="false" explicit="true" targetFramework="4.0"/>
   <httpModules>
   <add name="DomainServiceModule" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
   </httpModules>
 </system.web> 

Any help please? I'm stuck and read and searched about this problem for hours.

I can access the Azure machine with RDP. How can I debug/trace this issue? I'll be happy to use Fiddler/WCF Traces, if someone could lead me to the right way.


Check 2 things:

1) Make sure your proxy is setup correctly.

2) If you are using SSL, make sure you've installed the certificates on the phone / emulator.

The error you see is generic wcf speak for can't make a network connection.


This seemed to be a random error, which probably has been caused by not retrieving a connection to the service (although it was reachable). Refreshing the connection several times removed the exception eventually (this could take from minutes to a full day).

0

精彩评论

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

关注公众号