我正在尝试运行一个简单的WCF服务......
我的Wcf服务.config:
<system.serviceModel>
<services>
<service name ="WebService.Receptor">
<endpoint
address = "http://MyServer:8000/WS"
binding = "wsHttpBinding"
contract = "IMyContract"
/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
Run Code Online (Sandbox Code Playgroud)
我的Windows服务.config:
<system.serviceModel>
<client>
<endpoint
name = "Receptor"
address = "http://MyServer:8000/WS"
binding = "wsHttpBinding"
contract = "IMyContract"
/>
</client>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)
Obs:Wcf服务在Windows 7上的IIS 7.5下运行.
所以,当我尝试从wcf代理(IMyContract)调用方法时,我收到此错误:
在http:// MyServer:8000/WS上没有可以接受该消息的端点.这通常是由错误的地址或SOAP操作引起的.有关更多详细信息,请参阅InnerException(如果存在).
内在的例外:
{"无法连接到远程服务器"}
谁知道为什么?
Dar*_*rov 11
在IIS中承载WCF服务时,不要在地址中指定绝对URL.您应该使用.svc文件的相对URL .基本网址将由托管网站确定.
<service name="WebService.Receptor">
<endpoint
address="/WS.svc"
binding="wsHttpBinding"
contract="IMyContract"
/>
</service>
Run Code Online (Sandbox Code Playgroud)
在客户端上,根据IIS的配置方式,您应该明确指定完整地址:
<client>
<endpoint
name="Receptor"
address="http://MyServer:8000/WS.svc"
binding="wsHttpBinding"
contract="IMyContract"
/>
</client>
Run Code Online (Sandbox Code Playgroud)
这假设您已在IIS中配置了一个侦听8000端口的站点,并且您已在此站点内托管了WCF应用程序.
| 归档时间: |
|
| 查看次数: |
15291 次 |
| 最近记录: |