404找不到基于SSL端点的Web服务

时间:2013-01-23 12:15:04

标签: asp.net vb.net web-services security

我已经启动并运行了一个Web服务,通​​过浏览器我可以访问它并看到它正常运行。如果没有https,我可以拨打网络服务。

要在我使用小型控制台应用程序测试并查看结果时拨打电话。

服务器端我的web.config如下:

服务部分

<services>
    <service name="Website.mynamespace.Service1">
        <endpoint address="/service.svc" behaviorConfiguration=""  binding="wsHttpBinding" contract="SomeDLLFile.Anothernamespace.Services.Proxy.Interface1" ></endpoint>
        <endpoint address="/service.svc" behaviorConfiguration="" binding="wsHttpBinding" contract="SomeDLLFile.Anothernamespace.Services.Proxy.Interface1" bindingConfiguration="myBinding" />
        <endpoint address="mex" binding="wsHttpBinding" contract="IMetadataExchange"/>
      </service>
      <service name="Website.mynamespace.Service2">
        <endpoint address="/service.svc" behaviorConfiguration=""  binding="wsHttpBinding" contract="SomeDLLFile.Anothernamespace.Services.Proxy.Interface2" ></endpoint>
        <endpoint address="/service.svc" behaviorConfiguration="" binding="wsHttpBinding" contract="SomeDLLFile.Anothernamespace.Services.Proxy.Interface2" bindingConfiguration="myBinding" />
        <endpoint address="mex" binding="wsHttpBinding" contract="IMetadataExchange"/>
      </service>
</services>

使用过的绑定

  <wsHttpBinding>
    <binding name="myBinding">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
        </security>
    </binding>
  </wsHttpBinding>

在客户端(我的控制台应用程序),我已经为我的webservice添加了一个服务引用。这样我就能通过HTTP进行调用。但是,当使用HTTPS时,我收到错误说明以下

"There was no endpoint listening at https://test.mywebsite.nl/service.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details."

我的控制台应用程序中的app.config看起来像这样;

<client>
      <endpoint address="https://test.mywebsite.nl/service.svc" 
                binding="basicHttpBinding"
                bindingConfiguration="BasicHttpBinding_IProxyInterface1"
                contract="Service.IProxyInterface1" 
                name="BasicHttpBinding_IProxyClientInterface" />
      <endpoint address="https://test.mywebsite.nl/service.svc" 
                binding="basicHttpBinding"
                bindingConfiguration="BasicHttpBinding_IProxyInterface2"
                contract="Service.IProxyInterface2" 
                name="BasicHttpBinding_IProxyInterface2" />
</client>

<behaviors>
  <serviceBehaviors>
    <!-- 
      Step 2. Inside a <serviceBehaviors> section, add 
      a name attribute in the <behaviors> element that 
      matches the behaviorConfiguration attribute in the
      <service> element above.
    -->
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
      <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>

当我正在查看内部异常时,我正在查看404错误。我已经尝试过关于SO的其他主题以及MS上的文章的各种建议,但我必须遗漏一些东西,因为我仍然表示同样的错误。谁知道我在这里做错了什么?

2 个答案:

答案 0 :(得分:1)

通过SO上的this主题解决了问题。

问题在于服务名称,因此我将端点合并到一个服务定义中的两个合同中。我还将wsHttpBinding更改为basicHttpBinding。

答案 1 :(得分:0)

我有类似的东西,并在IIS中安装了自我认证的SSL证书。尝试:

http://weblogs.asp.net/scottgu/archive/2007/04/06/tip-trick-enabling-ssl-on-iis7-using-self-signed-certificates.aspx

显然,当您部署到生产环境中时,您需要购买适当的证书。