【发布时间】:2012-12-25 08:52:24
【问题描述】:
我在使用 Windows Phone 8 模拟器时遇到了一个大问题。
首先我有一个 Azure 项目,我有一个 WebRole,这个 WebRole 暴露了一些 DomainServices(RIA 服务)。
我公开了这个像 SOAP 这样的 DomainServices,以及其他应用程序,如 Windows 8 Metro 风格或 WPF 应用程序客户端,这些服务工作正常。
但我尝试使用 Windows Phone 8 模拟器使用此服务,但我做不到!
我关注了这篇文章:How to connect to a local web service from the Windows Phone 8 emulator
我需要更具体:
我在 Windows Azure 项目的 webRole 中有一个网站。
这个网站有一个 DomainServices(RIA 服务),因为我里面有一个 Silverlight 应用程序。 我用这个暴露了这个服务。
<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>
我可以将此服务与其他应用程序一起使用。 Windows Metro Style 和 WPF 以及此服务工作正常。
现在,我想为 Windows Phone 8 开发一个新的应用程序。但我需要使用这些服务。
在我的本地机器中,我尝试将此服务与模拟器连接,因此,我研究并发现模拟器是虚拟机,我需要配置 IIS Express。 我关注了这篇文章How to connect to a local web service from the Windows Phone 8 emulator
但我无法将托管在 webRole 中的服务与 Windows Phone 8 模拟器连接。
这是我的网站项目的结构:
这是我的 WebRole 的配置,称为 LandingPage,此 Web 角色具有服务。
这是 IIS Express 在 Applicationhost.config 中的配置。
<site name="LandingPage" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="E:\AnimesideFinal\AnimesideWebsite\LandingPage" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:24939:localhost" />
<binding protocol="http" bindingInformation="*:24939:192.168.2.114" />
</bindings>
</site>
这是运行在 IIS Express 中的应用程序不同的文章。
最后这是 Windows Phone 8 模拟器中服务的配置。
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_AuthenticationServiceSoap" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.2.114/Services/LandingPage-Services-AuthenticationService.svc/Soap"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_AuthenticationServiceSoap"
contract="AuthService.AuthenticationServiceSoap" name="BasicHttpBinding_AuthenticationServiceSoap" />
</client>
</system.serviceModel>
我按照文章的所有步骤操作,但没有结果。我认为出了点问题,因为我需要从 Azure 项目运行我的项目,并且在该项目的属性中存在使用 IIS express 或 IIS Web 服务器的选项。
这是 Windows Phone Emulator 的错误。
{System.ServiceModel.CommunicationException:远程服务器返回错误:NotFound。 ---> System.Net.WebException:远程服务器返回错误:NotFound。 ---> System.Net.WebException:远程服务器返回错误:NotFound。
在 System.Net.Browser.ClientHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
在 System.Net.Browser.ClientHttpWebRequest.c__DisplayClasse.b__d(Object sendState)
在 System.Net.Browser.AsyncHelper.c__DisplayClass1.b__0(对象 sendState)
--- 内部异常堆栈跟踪结束 ---
在 System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod,对象状态)
在 System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
在 System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult 结果)
--- 内部异常堆栈跟踪结束 ---
在 System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult 结果)
在 System.ServiceModel.Channels.ServiceChannel.EndCall(字符串操作,对象 [] 输出,IAsyncResult 结果)
在 System.ServiceModel.ClientBase1.ChannelBase1.EndInvoke(String methodName, Object[] args, IAsyncResult 结果)
在 AnimesideWP7.AuthService.AuthenticationServiceSoapClient.AuthenticationServiceSoapClientChannel.EndLogin(IAsyncResult 结果)
在 AnimesideWP7.AuthService.AuthenticationServiceSoapClient.AnimesideWP7.AuthService.AuthenticationServiceSoap.EndLogin(IAsyncResult 结果)
在 AnimesideWP7.AuthService.AuthenticationServiceSoapClient.OnEndLogin(IAsyncResult 结果)
在 System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult 结果)}
感谢您的帮助。
问候。
【问题讨论】:
-
与论坛网站不同,我们不使用“谢谢”、“感谢任何帮助”或Stack Overflow 上的签名。请参阅“Should 'Hi', 'thanks,' taglines, and salutations be removed from posts?.
-
“它不起作用”是什么意思?是否有任何错误或您无法得到响应或什么?更具体。
标签: wcf azure windows-phone-8-emulator