WCF 非http寄宿IIS

來源:互聯網
上載者:User

標籤:lan   步驟   bind   asi   ebe   服務   target   img   需要   

一:產生一個簡單的wcf項目,以及IIS服務配置,發布項目 ,步驟

二:Web.config配置

<?xml version="1.0" encoding="utf-8"?><configuration>  <appSettings>    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />  </appSettings>  <system.web>    <compilation debug="true" targetFramework="4.5" />    <httpRuntime targetFramework="4.5"/>  </system.web>  <system.serviceModel>

<services> <service name="TcpWcf.Service1" > <endpoint binding="netTcpBinding" address="" contract="TcpWcf.IService1" /> <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/> <host> <baseAddresses> <add baseAddress="net.tcp://localhost:7878/Service1.svc"/> </baseAddresses> </host> </service> </services> <bindings> <netTcpBinding> <binding portSharingEnabled="true"></binding> </netTcpBinding> </bindings>

<behaviors> <serviceBehaviors> <behavior> <!-- 為避免泄漏中繼資料資訊,請在部署前將以下值設定為 false --> 【需要修改】 <serviceMetadata httpGetEnabled="false" httpsGetEnabled="false"/> <!-- 要接收故障異常詳細資料以進行調試,請將以下值設定為 true。在部署前設定為 false 以避免泄漏異常資訊 --> <serviceDebug includeExceptionDetailInFaults="false"/> 【需要修改】
</behavior> </serviceBehaviors> </behaviors> <protocolMapping> <add binding="basicHttpsBinding" scheme="https" /> </protocolMapping> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> <directoryBrowse enabled="true"/> </system.webServer> </configuration>

 

三:發布時網站配置

四:發布後的結果

五:用戶端引用,引用時需要多點幾次

 

WCF 非http寄宿IIS

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.