亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

WCF4.0安裝 NET.TCP啟用及常見問題

發布時間:2020-10-18 09:08:17 來源:網絡 閱讀:569 作者:rmlifejun 欄目:編程語言

WCF4.0安裝及NET.TCP啟用

 

WCF 4.0 一般默認安裝.net Framework 4.0的時候已經安裝。

但如果先裝.net framework 4.0,后裝IIS,就會出現問題。需要重新注冊WCF4.0。

WCF4.0 已經是.net 4.0的一個內部組件,不需要.net3.5 那樣麻煩先裝windows組件。 

 

一、確認是否安裝WCF4.0:

 

如下圖,查看*.svc 后綴的文件是否被svc-Integrated-4.0 或 svc-ISAPI-4.0_64/32bit 程序處理:

 WCF4.0安裝 NET.TCP啟用及常見問題

 如果沒有上面的三個處理程序,則可以判定 wcf 4.0 沒有安裝。

 

二、安裝WCF 4.0

找到對應的.net framework 目錄,運行命令:

"%WINDIR%\Microsoft.Net\Framework\v4.0.30319\aspnet_regiis" –i –enable

"%WINDIR%\Microsoft.Net\Framework\v4.0.30319\ServiceModelReg.exe" -r

 

Running the command aspnet_regiis –i –enable will make the Default App Pool run using .NET Framework 4, which may produce incompatibility issues for other applications on the same computer.

 

如果你有另外的app Pool,可以不用管這個 –enable,可以手動去設置那個pool的.net 版本是4.0.

 

 三、啟動服務:NetTCP Listener Adapter 和 Net TCp Port Sharing Service:

 

 WCF4.0安裝 NET.TCP啟用及常見問題

 

 

四、為IIS站點配置NETTCP協議支持:

 

 

1)綁定808:*端口:

 WCF4.0安裝 NET.TCP啟用及常見問題

 

 

2)啟用net.tcp協議:

如果不配置會出現下面錯誤:

 

Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http].

 

WCF4.0安裝 NET.TCP啟用及常見問題

 

五、WCF3.0 和WCF 4.0 沖突:

 

如果有.net 3.5 和.net 4.0同時存在,有可能程序會找錯對應的處理程序。

 

Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′.

 

重新注冊就可以:

"%WINDIR%\Microsoft.Net\Framework\v4.0.30319\aspnet_regiis" –i –enable

"%WINDIR%\Microsoft.Net\Framework\v4.0.30319\ServiceModelReg.exe" -r

 

 

我有參考這篇文章:http://www.cnblogs.com/Gyoung/archive/2012/12/11/2812555.html

在 WCF 4.0 啟用NET.TCP  不需要 這2個操作:

1) 安裝WAS

WCF4.0安裝 NET.TCP啟用及常見問題

2) 確定WCF是否啟用Non-Http支持

WCF4.0安裝 NET.TCP啟用及常見問題

 

 

 六、其他可能的錯誤:

1) IIS站點多主機頭綁定的錯誤:

Server Error in '/WcfServiceOfMyTest' Application.

This collection already contains an address with scheme http. There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.
Parameter name: item

 

方法是:在config的</system.serviceModel> 里面允許多主機頭綁定:

</system.serviceModel>
.......
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>

 

2) 為什么測試界面的協議不一樣 

svcutil.exe http://localhost/WcfServiceOfMyTest/Service1.svc?wsdl

svcutil.exe ://dst52382.cn1.global.ctrip.com/WcfServiceOfMyTest/Service1.svc/mex

區別在協議 http 和 net.tcp 的是否啟用,配置在這里會影響:

 <serviceMetadata httpGetEnabled="false"/>

 

WCF4.0安裝 NET.TCP啟用及常見問題

 

 

七、測試程序

新建一個默認的wcf service

配置如下:

 

WCF4.0安裝 NET.TCP啟用及常見問題

<?xml version="1.0"?><configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
    <system.serviceModel>
      <protocolMapping>
        <add scheme="tcp" binding="netTcpBinding"/>
      </protocolMapping>
      <bindings>
        <netTcpBinding>
          <binding name="netTcpBindConfig"  closeTimeout="00:30:00" portSharingEnabled="true"
                  openTimeout="00:30:00" receiveTimeout="00:30:00" sendTimeout="00:30:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
                    maxConnections="100" maxReceivedMessageSize="2147483647"
                  transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
                  hostNameComparisonMode="StrongWildcard" listenBacklog="100">

            <readerQuotas maxDepth="2147483647"
                                      maxStringContentLength="2147483647"
                                      maxArrayLength="2147483647"
                                      maxBytesPerRead="2147483647"
                                      maxNameTableCharCount="2147483647" />
            <reliableSession ordered="true"  inactivityTimeout="00:01:00" enabled="false" />
            <security mode="None">
              <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign"  />
              <message clientCredentialType="Windows"  />
            </security>
          </binding>
        </netTcpBinding>
      </bindings>
      <services>

        <service behaviorConfiguration="MyBehavior" name="WcfServiceOfMyTest.Service_Test_NetTcp"> <!--這個服務名字不是隨便取得,要跟你的class文件里的類的名字一致!-->
          <endpoint address="" binding="netTcpBinding" contract="WcfServiceOfMyTest.IJustAnInterface" bindingConfiguration="netTcpBindConfig"></endpoint>
          <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" ></endpoint>
        </service>

      </services>
      <behaviors>
        <serviceBehaviors>
          <behavior name="MyBehavior" >
            <serviceMetadata httpGetEnabled="false"/>
            <serviceDebug includeExceptionDetailInFaults="true" />
            <dataContractSerializer maxItemsInObjectGraph="6553600"/>
          </behavior>
        </serviceBehaviors>
      </behaviors>
      <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    </system.serviceModel>

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer></configuration>

WCF4.0安裝 NET.TCP啟用及常見問題

這個配置會有錯誤:

There is no compatible TransportManager found for URI 'net.tcp://dst52382.cn1.global.ctrip.com/WcfServiceOfMyTest/Service1.svc/mex'. This may be because that you have used an absolute address which points outside of the virtual application, or the binding settings of the endpoint do not match those that have been set by other services or endpoints. Note that all bindings for the same protocol should have same settings in the same application.

對應的中文描述:

未找到 URI“net.tcp://gyoung/Service1.svc/mex”的兼容 TransportManager。這可能是因為使用了指向虛擬應用程序外部的絕對地址,或終結點的綁定設置與其他服務或終結點所設置的綁定設置不匹配。 請注意,同一協議的所有綁定在同一應用程序中應具有相同的設置。

這個錯誤的重點在后半句話,endpoint的binding配置需要一致,這里2個endpoint,一個是服務終結點,它的 maxConnections="100" 不是默認值10,另外一個是元數據終結點,這里的max connection默認是10.

<endpoint address="" binding="netTcpBinding"
<endpoint address="mex" binding="mexTcpBinding"

他們的binding類型不一致。將他們改為一致。如下:
 <service behaviorConfiguration="MyBehavior" name="WcfServiceOfMyTest.Service_Test_NetTcp">
      <endpoint address="" binding="netTcpBinding" contract="WcfServiceOfMyTest.IJustAnInterface" bindingConfiguration="netTcpBindConfig"></endpoint>
      <endpoint address="mex" binding="netTcpBinding" contract="IMetadataExchange"  bindingConfiguration="netTcpBindConfig" ></endpoint>
 </service>

 

八、完整源代碼:

接口源代碼:

WCF4.0安裝 NET.TCP啟用及常見問題

  GetData(  boolValue =  stringValue =   {  { boolValue =  {  { stringValue =

WCF4.0安裝 NET.TCP啟用及常見問題

 

服務源代碼:

WCF4.0安裝 NET.TCP啟用及常見問題

       GetData( .Format( (composite ==   ArgumentNullException(+=

WCF4.0安裝 NET.TCP啟用及常見問題

 

web.config 配置:

WCF4.0安裝 NET.TCP啟用及常見問題

<?xml version="1.0"?><configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
    <system.serviceModel>
      <protocolMapping>
        <add scheme="tcp" binding="netTcpBinding"/>
      </protocolMapping>
      <bindings>
        <netTcpBinding>
          <binding name="netTcpBindConfig"  closeTimeout="00:30:00" portSharingEnabled="true"
                  openTimeout="00:30:00" receiveTimeout="00:30:00" sendTimeout="00:30:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
                    maxConnections="100" maxReceivedMessageSize="2147483647"
                  transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
                  hostNameComparisonMode="StrongWildcard" listenBacklog="100">

            <readerQuotas maxDepth="2147483647"
                                      maxStringContentLength="2147483647"
                                      maxArrayLength="2147483647"
                                      maxBytesPerRead="2147483647"
                                      maxNameTableCharCount="2147483647" />
            <reliableSession ordered="true"  inactivityTimeout="00:01:00" enabled="false" />
            <security mode="None">
              <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign"  />
              <message clientCredentialType="Windows"  />
            </security>
          </binding>
        </netTcpBinding>
      </bindings>
      <services>

        <service behaviorConfiguration="MyBehavior" name="WcfServiceOfMyTest.Service_Test_NetTcp">
          <endpoint address="" binding="netTcpBinding" contract="WcfServiceOfMyTest.IJustAnInterface" bindingConfiguration="netTcpBindConfig"></endpoint>
          <endpoint address="mex" binding="netTcpBinding" contract="IMetadataExchange"  bindingConfiguration="netTcpBindConfig" ></endpoint>
        </service>

      </services>
      <behaviors>
        <serviceBehaviors>
          <behavior name="MyBehavior" >
            <serviceMetadata httpGetEnabled="false"/>
            <serviceDebug includeExceptionDetailInFaults="true" />
            <dataContractSerializer maxItemsInObjectGraph="6553600"/>
          </behavior>
        </serviceBehaviors>
      </behaviors>
      <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    </system.serviceModel>

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer></configuration>

WCF4.0安裝 NET.TCP啟用及常見問題

 

九、HTTP 與 NET.TCP 通信效率的差別

 

WCF4.0安裝 NET.TCP啟用及常見問題

 

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

监利县| 镇赉县| 绩溪县| 邹平县| 象州县| 若尔盖县| 都江堰市| 威海市| 鸡西市| 县级市| 唐河县| 霸州市| 泌阳县| 小金县| 苏尼特左旗| 岳阳市| 嘉义县| 抚松县| 建德市| 通山县| 临颍县| 高州市| 远安县| 台前县| 洞口县| 珲春市| 巨野县| 古田县| 邯郸市| 凉山| 夹江县| 随州市| 溧水县| 孟连| 福清市| 科技| 云南省| 新巴尔虎左旗| 扎赉特旗| 达孜县| 宜丰县|