簡體   English   中英

添加新的HTTP和HTTPS綁定后,WCF停止在IIS 7上工作

[英]WCF stopped working on IIS 7 after adding new HTTP and HTTPS bindings

我在C#使用ASP.NET 3.5 我有一個具有WCFweb-application 我已經將它部署在具有Bindings HTTPHTTPS Bindings HTTP服務器上。 一切都很好。

今天,我在同一站點上又添加了兩個HTTPHTTPS綁定,但with different host names (我已經注冊了該新域,並且已經用我的IP地址指出了這一點)。 突然,該站點的WCF停止工作。

我在IIS兩個站點上做到了,它們都在WCF調用中返回異常,但是login和所有其他頁面都工作正常。

web.config的ServiceModel部分如下所示:

     <system.serviceModel>
        <bindings>
            <webHttpBinding>
                <binding name="webBindingHTTP">
                    <security mode="TransportCredentialOnly">
                        <transport clientCredentialType="None" />
                    </security>
                </binding>
                <binding name="webBindingHTTPS">
                    <security mode="Transport">
                        <transport clientCredentialType="None" />
                    </security>
                </binding>
            </webHttpBinding>
        </bindings>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true">
        </serviceHostingEnvironment>
        <behaviors>
            <endpointBehaviors>
                <behavior name="ihrole.service.remoteBehavior">
                    <webHttp />
                </behavior>
                <behavior name="webHttpEnabled">
                    <webHttp/>
                </behavior>
            </endpointBehaviors>
            <serviceBehaviors>
                <behavior name="ihrole.service.remoteBehavior">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <services>
            <service behaviorConfiguration="ihrole.service.remoteBehavior" name="ihrole.service.remote">
                <endpoint address="" behaviorConfiguration="ihrole.service.remoteBehavior" bindingConfiguration="webBindingHTTP" binding="webHttpBinding" contract="ihrole.service.Iremote" />
                <endpoint address="" behaviorConfiguration="ihrole.service.remoteBehavior" bindingConfiguration="webBindingHTTPS" binding="webHttpBinding" contract="ihrole.service.Iremote" />
            </service>
        </services>
    </system.serviceModel>

同樣,我確實在同一IIS上托管了另一個站點,該站點也具有HTTPHTTPS綁定。 但是我尚未在該站點中添加新的站點,並且WCF調用在同一站點上運行良好。

任何猜測或解決方案? 提前致謝..

在這里,您需要指定WCF服務可以在單個網站的所有綁定上運行。

在Asp.Net 3.5中,當網站具有多個綁定時,應使用<baseAddressPrefixFilters>元素指定“通過過濾器”(為WCF服務添加基地址)。 請參閱下面的示例。 MSDN reference here.

<system.serviceModel>
    <serviceHostingEnvironment>
    ... 
        <baseAddressPrefixFilters>
            <add prefix="http://Testsite2.com:3546"/>
            <add prefix="http://testSite.com:3566"/>
        </baseAddressPrefixFilters>
   ...
    </serviceHostingEnvironment>
</system.serviceModel>

因此,這里http://Testsite2.com:3546http://testSite.com:3566是它們各自方案的唯一基址,將允許它們通過,這意味着WCF服務將可以正常工作這兩個地址。 baseAddressPrefixFilter不支持任何通配符。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM