我整天都在与 WCF RIA 域服务作斗争。
我正在编写一个部署在 Windows Azure 上的 WCF RIA 服务库。我通过Silverlight和Windows Phone 7 Client访问它。我的云应用程序中有两个 ASP.NET 项目作为两个 Web 角色,它们充当两个不同的端点。
第一个通过 SSL 为 Silverlight 客户端提供访问。
第二个是一个简单的端点,没有 WP7 客户端的身份验证。它在端口 8080 上运行。
在我当地的卡西尼号上一切正常。我可以使用两个客户端访问该服务。在云端我只能使用 Silverlight 客户端。当我尝试使用 WP7 应用程序访问服务时,我得到:
System.ServiceModel.EndpointNotFoundException wurde nicht behandelt。Message=在http://myapp.cloudapp.net:8080/Services/MyRIAServiceLib-Web-MyService.svc/soap上没有可以接受消息的端点监听。这通常是由不正确的地址或 SOAP 操作引起的。有关更多详细信息,请参阅 InnerException(如果存在)。
内部异常是 System.Net.WebException 类型并说:
远程服务器返回错误:NotFound
我向我的 WP7 应用程序添加了一个自动化的 ServiceReference 以连接到 WCF 服务。当我这样做时,VS2010成功识别服务并生成代码以使其可用。这一定意味着该服务可用并且可以找到,对吗?当我通过浏览器访问http://myapp.cloudapp.net:8080/MyRIAServiceLib-Web-MyService.svc时,我可以看到通常的“您已创建服务。”-页面。
我已将所有 dll 添加为设置为 true 的本地副本,这可能在云中丢失,但也许我错过了一些。我的 web.config 看起来像这样:
<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.SoapXmlEndpointFactory, 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>
请问有什么帮助吗?我被困住并阅读和搜索了几个小时。
我可以使用 RDP 访问 Azure 机器。如何调试/跟踪此问题?如果有人能引导我走向正确的道路,我会很乐意使用 Fiddler/WCF Traces。