0

我已经启动并运行了一个 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>

在客户端(我的控制台应用程序)上,我添加了对我的 web 服务的服务引用。这样我就可以通过 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 上的文章的各种建议,但我一定遗漏了一些东西,因为我仍然遇到同样的错误。有人知道我在这里做错了什么吗?

4

2 回答 2

1

由于这个主题在这里解决了这个问题。

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

于 2013-01-25T11:33:36.793 回答
0

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

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

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

于 2013-01-23T22:42:47.860 回答