WCF net.tcp 消息推送

如何将net.tcp协议寄宿到IIS


1 部署IIS

1.1 安装WAS

IIS原本是不支持非HTTP协议的服务,为了让IIS支持net.tcp,必须先安装WAS(Windows Process Activation Service),即windows进程激活服务。

打开控制面板--程序和功能--打开或关闭windows功能,安装WAS,如图:

安装完毕后在Services窗口中可以到到如下服务:Windows Process Activation Service;Net.Msmq Listener Adapter;Net.Pipe Listener Adapter;Net.Tcp Listener Adapter;Net.Tcp Port Sharing Service.这几个服务。确定Net.Tcp Listener Adapter 与Net.Tcp Port Sharing Service是否已经启动。

1.2  确定WCF是否启用Non-Http支持

同样是在控件面板中打开这个功能,如图:

1.3 给站点添加net.tcp绑定

在IIS中,选中你的网站,然后在右边的操作菜单栏中单击绑定,会弹出一个“网站绑定”窗口,点击添加,类型选择net.tcp

1.4 启用net.tcp协议

 选择你的网站,点击“高级设置”,弹出的的窗体中,在“已启用的协议”一栏中手动添加:net.tcp

配置服务:

  
      <netTcpBinding>
        <binding name="Binding1" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
          <security mode="None"></security>
        </binding>
      </netTcpBinding>

 <service  name="WcfService.IMessageService">
        <endpoint address="" binding="netTcpBinding" bindingConfiguration="Binding1" contract="WcfService.IIMessageService"/>
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:99/IMessageService"/>
          </baseAddresses>
        </host>
      </service>

猜你喜欢

转载自blog.csdn.net/yangangwuwuyangang/article/details/72654700
WCF