WCF EndPoints无法使用IIS主机

时间:2013-08-06 16:02:08

标签: wcf iis endpoint

我有以下设置

<services>
    <service name="HelloWCFServiceClass.clsHelloWCFServiceClass" >
      <host>
        <baseAddresses>
          <add baseAddress="http://localhost:6789/IISHosting/HelloWorldISSHostedService.svc"/>
        </baseAddresses>
      </host>
      <endpoint address="" binding="wsHttpBinding"  contract="HelloWCFServiceContract.IHelloWCFServiceContract" />
      <endpoint address="/test" binding="basicHttpBinding"
                         contract="HelloWCFServiceContract.IHelloWCFServiceContract"/>
    </service>
</services>

我可以打开

http://{ServerName}:6789/HelloWorldISSHostedService.svc

但我收到了错误

  

无法找到网页

尝试通过这样的终点访问时

http://{ServerName}:6789/HelloWorldISSHostedService.svc/test

2 个答案:

答案 0 :(得分:0)

您正在使用BasicHttpBinding - 这是 SOAP 绑定,您不能只使用浏览器浏览到该端点。

您需要使用SoapUI之类的东西来测试您的SOAP服务。

如果您想要一个可在浏览器中测试的服务(只需导航到某个网址),则需要使用webHttpBinding代替( REST 服务)

答案 1 :(得分:0)

如果您的服务是MVC项目的一部分,则需要配置路由表

http://www.asp.net/mvc/tutorials/older-versions/controllers-and-routing/asp-net-mvc-routing-overview-cs

相关问题