首页 > 代码库 > WCF 非http寄宿IIS
WCF 非http寄宿IIS
一:生成一个简单的wcf项目,以及IIS服务配置,发布项目 ,步骤
二:Web.config配置
<?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> <add key="aspnet:UseTaskFriendlySynchronizationContext" value=http://www.mamicode.com/"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个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。