標籤: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