无法从Windows Phone 7 emulator调用WCF服务方法
我是WCF的新手,我正在尝试创建一个调用自托管WCF服务的WindowsPhone7应用程序。我已经在控制台应用程序中创建了WCF服务。我无法从emulator中运行的Windows 7应用程序调用该服务,但我可以从同一台计算机上运行的另一个客户端控制台应用程序(WCF服务)调用该服务。windows phone应用程序和客户端控制台应用程序的服务调用代码和WCF配置文件类似 服务配置无法从Windows Phone 7 emulator调用WCF服务方法,wcf,windows-phone-7,Wcf,Windows Phone 7,我是WCF的新手,我正在尝试创建一个调用自托管WCF服务的WindowsPhone7应用程序。我已经在控制台应用程序中创建了WCF服务。我无法从emulator中运行的Windows 7应用程序调用该服务,但我可以从同一台计算机上运行的另一个客户端控制台应用程序(WCF服务)调用该服务。windows phone应用程序和客户端控制台应用程序的服务调用代码和WCF配置文件类似 服务配置 <configuration> <system.serviceModel>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceMetadata/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="BusinessServices.ServiceA" behaviorConfiguration="serviceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://warp-core:8000"/>
</baseAddresses>
</host>
<endpoint address="ServiceA" contract="BusinessServiceContracts.IServiceA" binding="basicHttpBinding" />
<endpoint binding="mexHttpBinding" bindingConfiguration="" name="mex" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
</configuration>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IServiceA" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
maxBufferSize="65536" maxReceivedMessageSize="65536" textEncoding="utf-8">
<security mode="None" />
</binding>
<binding name="basicHttp" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://warp-core:8000/ServiceA" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IServiceA" contract="ServiceA.IServiceA"
name="BasicHttpBinding_IServiceA" />
</client>
</system.serviceModel>
</configuration>
我收到带有消息的ServerTooBusyException
The HTTP service located at http://warp-core:8000/ServiceA is too busy.
如果我尝试另一种阻塞方法调用服务,如下所示,那么手机应用程序将挂起,并且下面的方法调用将永远不会返回
private void button1_Click(object sender, RoutedEventArgs e)
{
IAsyncResult result = m_proxyA.BeginOperation1(null, null);
string output = m_proxyA.EndOperation1(result);
}
如果我在客户端控制台应用程序中尝试这一点,上述两个代码示例都可以工作
关于这里可能缺少的内容,有什么想法吗?我首先要看的是ClientConfig文件。它是否存在于您的Windows Phone 7项目中?可以在中找到一些指向您的问题的指针。迈克发了一些。您是否尝试过打开WCF服务的跟踪功能以检查是否存在任何问题?我已经阅读了您提到的帖子。启用WCF跟踪成功了。我的服务配置中有多个端点,而该服务正在侦听另一个端点。更改端点的顺序使我的WP7客户端与WCF服务进行了对话。谢谢
private void button1_Click(object sender, RoutedEventArgs e)
{
IAsyncResult result = m_proxyA.BeginOperation1(null, null);
string output = m_proxyA.EndOperation1(result);
}