使用 WP7 访问时,WCF RIA 在 Azure 中给出 EndpointNotFoundException
我一整天都在与 WCF RIA 域服务的问题作斗争。
我正在编写一个 WCF RIA 服务库,它部署在 Windows Azure 上。我通过 Silverlight 和 Windows Phone 7 客户端 访问它。我的云应用程序中有两个 ASP.NET 项目作为两个 Web 角色,它们充当两个不同的端点。
第一个通过 SSL 为 Silverlight 客户端提供访问。
第二个是简单端点,无需对 WP7 客户端进行身份验证。它在端口 8080 上运行。
在我本地的卡西尼号上一切正常。我可以通过两个客户端访问该服务。 在云中我只能使用Silverlight Client。当我尝试使用 WP7 应用程序访问该服务时,我得到:
System.ServiceModel.EndpointNotFoundException 没有发生。 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。
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.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>
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查两件事:
1)确保您的代理设置正确。
2) 如果您使用 SSL,请确保您已在手机/模拟器上安装了证书。
您看到的错误是通用 wcf 表示无法建立网络连接。
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).