在IIS上配置soap:address位置到域名

问题描述 投票:0回答:1

我在运行 IIS 的共享主机上有一个 Web 服务。我想在安全连接上运行 Web 服务。然而,当我去https://mywebsitename.com/test.svc?wsdl soap:address 地址指向http://servername.webhost.com/test.svc.

我错过了什么?我无法使用安全连接。

<wsdl:service name="test">
   <wsdl:port name="BasicHttpBinding_Itest" binding="tns:BasicHttpBinding_Itest">
       <soap:address location="http://servername.webhost.com/test.svc"/>
   </wsdl:port>
</wsdl:service>

如果我去不安全的http://mywebsitename.com/test.svc?wsdl然后它返回域名。

<wsdl:service name="test">
   <wsdl:port name="BasicHttpBinding_Itest" binding="tns:BasicHttpBinding_Itest">
       <soap:address location="http://mywebsitename.com/test.svc"/>
   </wsdl:port>
</wsdl:service>

这就是我的配置:

<system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior >
                <serviceMetadata
                         httpGetEnabled="false"
                         httpsGetEnabled="true"/>
                <serviceDebug includeExceptionDetailInFaults="true"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment  aspNetCompatibilityEnabled="true"
                    multipleSiteBindingsEnabled="true"/>
</system.serviceModel>

我尝试添加指定 httpsGetUrl 到 serviceMetaData

<serviceMetadata httpsGetUrl="https://mywebsitename.com/test.svc?wsdl"
            httpGetEnabled="false"
            httpsGetEnabled="true"/>

但是我收到有关 multipleSiteBindingsEnabled 的错误消息。

When 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' is set to true in configuration, the endpoints are required to specify a relative address. If you are specifying a relative listen URI on the endpoint, then the address can be absolute. To fix this problem, specify a relative uri for endpoint 'https://mywebsitename.com/test.svc?wsdl'.

如果我禁用 multipleSiteBindingsEnabled,则会收到此错误消息。

This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting

我还更改了前端应用程序的绑定

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="SecurityByTransport_Itest">
                <security mode="Transport">
                    <transport clientCredentialType="None" />
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <clear/>
        <endpoint address="https://mywebsitename.com/test.svc"
              binding="basicHttpBinding"
              bindingConfiguration="SecurityByTransport_Itest"
              contract="FrontPageService.Itest"
              name="SecurityByTransport_Itest" />

    </client>
</system.serviceModel>

然而,当我从前端调用 Web 服务时,内部异常有此错误消息。

The remote server returned an error: (404) Not Found.
wcf
1个回答
0
投票

确保服务器上正确安装了SSL证书,并且您的服务配置文件中的SSL绑定配置正确。

改变

<soap:address location="http://servername.webhost.com/test.svc"/>

<soap:address location="https://mywebsitename.com/test.svc"/>
© www.soinside.com 2019 - 2024. All rights reserved.