WCF netTcpBinding寄宿到IIS7 陈

config配置文件不多说

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <behaviors>
            <serviceBehaviors>
                <behavior name="myBehavior">
                    <serviceMetadata/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <bindings>
          
            <netTcpBinding>
            
                <binding name="myBind" maxReceivedMessageSize="1073741824" transferMode="Buffered" />
            
            </netTcpBinding>

        </bindings>
        <services>
            <service name="WcfServices.Services.Job"  behaviorConfiguration="myBehavior">
                <endpoint name="WcfServices.Services"
                          bindingConfiguration="myBind"
                          address=""
                          binding="netTcpBinding"
                          contract="WcfServices.Contract.IJob">
                </endpoint>
                <endpoint address="mex"
                          binding="mexTcpBinding"
                          contract="IMetadataExchange">
                    
                </endpoint>
                <!-- 不用地址 <host>
                    <baseAddresses>
                        <add baseAddress="net.tcp://localhost:8000/Job"/>
                    </baseAddresses>
                </host>-->
            </service>
        </services>
    </system.serviceModel>
</configuration>

在项目属性选择Web选项卡,使用本地IIS,创建虚拟目录http://localhost/WcfServices,提示安装IIS6,进入控制面板安装IIS6,

还有Framewok3.5.1(不知道不装什么效果没试),安装后,运行打开地址+xx.svc,报错未能从程序集“System.ServiceModel, Version=3.0.0.0,百度找到答案,在继续弄,还是不行出错Could not find a base address that matches scheme net.tcp for the endpoint with binding MetadataExchangeTcpBinding. Registered base address schemes are [http].,后来看了篇大神的文章,原来要支持net.tcp(地址http://www.cnblogs.com/chamy/archive/2012/11/02/2751367.html),OK搞定,使用svcutil 获取元数据。

原文地址:https://www.cnblogs.com/Chareree/p/2814248.html