我有这个计划:
IIS
WPF客户端
如果我转到 OperatorService ,则会激活该服务,启动Web应用程序,并在http://localhost:8020/ClientService
成功托管 ClientService 。到目前为止一切都很好。
我现在可以在浏览器中访问上述网址中的 ClientService ,我可以通过添加服务参考添加它。它就在那里 - 跑步。
但是当我尝试通过生成的客户端连接(看起来没问题)时,它突然无效。投掷:
There was no endpoint listening at http://localhost:8020/ClientService that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
此外, OperatorService 连接到此 ClientService 本身(它是一个提供通知的WsDualHttpBinding)。它正确地订阅了这个服务(调用方法)并且它可以工作(与我的WPF客户端相同的URL)。
为什么我无法从我的WPF客户端连接?
WPF客户端配置(仅限相关部分):
<client>
<endpoint address="http://localhost:8020/ClientService" binding="wsDualHttpBinding"
bindingConfiguration="DefaultBindingClientService" contract="Server.IClientService"
name="DefaultBindingClientService">
<identity>
<servicePrincipalName value="host/OHS-UPC" />
</identity>
</endpoint>
</client>
<bindings>
<wsDualHttpBinding>
<binding name="DefaultBindingClientService" />
</wsDualHttpBinding>
</bindings>
IIS托管了web.config(针对 ClientService )
<service name="TelPro.OHS.Server.Services.ClientService" behaviorConfiguration="UnsecuredBehavior">
<endpoint address="" binding="wsDualHttpBinding" bindingConfiguration="DefaultBindingClientService" contract="TelPro.OHS.Server.Services.IClientService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8020/ClientService"/>
</baseAddresses>
</host>
</service>
<wsDualHttpBinding>
<binding name="DefaultBindingClientService"/>
</wsDualHttpBinding>
<behavior name="UnsecuredBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
IIS托管了web.config(适用于OperatorService - &gt; ClientService)
<client>
<endpoint address="http://localhost:8020/ClientService" binding="wsDualHttpBinding"
bindingConfiguration="DefaultBindingClientService" contract="ClientNotificationServer.IClientService"
name="DefaultBindingClientService" />
</client>
<wsDualHttpBinding>
<binding name="DefaultBindingClientService" />
</wsDualHttpBinding>
答案 0 :(得分:0)
我能够通过切换到端口80来解决它。
http://localhost/ClientService
不知何故有效。我试图在任何地方向端口8020添加规则(甚至停止防火墙),检查任何端口转发,Azure端点等。我的理论是当服务器尝试连接回(回调)到客户端并且没有时的问题权利等等。我的猜测是IIS托管服务没有足够的权限进行连接。如果任何人仍然能够阐明原因,我很乐意转回答案。但到目前为止,无论港口如何,我都很高兴它能运作。