中文字幕第五页-中文字幕第页-中文字幕韩国-中文字幕最新-国产尤物二区三区在线观看-国产尤物福利视频一区二区

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

WCF4.0安裝及NET.TCP啟用

創新互聯建站專業為企業提供巴彥淖爾網站建設、巴彥淖爾做網站、巴彥淖爾網站設計、巴彥淖爾網站制作等企業網站建設、網頁設計與制作、巴彥淖爾企業網站模板建站服務,10年巴彥淖爾做網站經驗,不只是建網站,更提供有價值的思路和整體網絡服務。

 

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>
.......
<serviceHostingEnvironmentmultipleSiteBindingsEnabled="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 的是否啟用,配置在這里會影響:

 <serviceMetadatahttpGetEnabled="false"/>

 

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

 

 

七、測試程序

新建一個默認的wcf service

配置如下:

 

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

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

  <system.web>
    <compilationdebug="true" targetFramework="4.0" />
  </system.web>
    <system.serviceModel>
      <protocolMapping>
        <addscheme="tcp" binding="netTcpBinding"/>
      </protocolMapping>
      <bindings>
        <netTcpBinding>
          <bindingname="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">

            <readerQuotasmaxDepth="2147483647"
                                      maxStringContentLength="2147483647"
                                      maxArrayLength="2147483647"
                                      maxBytesPerRead="2147483647"
                                      maxNameTableCharCount="2147483647" />
            <reliableSessionordered="true"  inactivityTimeout="00:01:00" enabled="false" />
            <securitymode="None">
              <transportclientCredentialType="Windows" protectionLevel="EncryptAndSign"  />
              <messageclientCredentialType="Windows"  />
            </security>
          </binding>
        </netTcpBinding>
      </bindings>
      <services>

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

      </services>
      <behaviors>
        <serviceBehaviors>
          <behaviorname="MyBehavior" >
            <serviceMetadatahttpGetEnabled="false"/>
            <serviceDebugincludeExceptionDetailInFaults="true" />
            <dataContractSerializermaxItemsInObjectGraph="6553600"/>
          </behavior>
        </serviceBehaviors>
      </behaviors>
      <serviceHostingEnvironmentmultipleSiteBindingsEnabled="true" />
    </system.serviceModel>

  <system.webServer>
    <modulesrunAllManagedModulesForAllRequests="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類型不一致。將他們改為一致。如下:
 <servicebehaviorConfiguration="MyBehavior" name="WcfServiceOfMyTest.Service_Test_NetTcp">
      <endpointaddress="" binding="netTcpBinding" contract="WcfServiceOfMyTest.IJustAnInterface" bindingConfiguration="netTcpBindConfig"></endpoint>
      <endpointaddress="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>
    <compilationdebug="true" targetFramework="4.0" />
  </system.web>
    <system.serviceModel>
      <protocolMapping>
        <addscheme="tcp" binding="netTcpBinding"/>
      </protocolMapping>
      <bindings>
        <netTcpBinding>
          <bindingname="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">

            <readerQuotasmaxDepth="2147483647"
                                      maxStringContentLength="2147483647"
                                      maxArrayLength="2147483647"
                                      maxBytesPerRead="2147483647"
                                      maxNameTableCharCount="2147483647" />
            <reliableSessionordered="true"  inactivityTimeout="00:01:00" enabled="false" />
            <securitymode="None">
              <transportclientCredentialType="Windows" protectionLevel="EncryptAndSign"  />
              <messageclientCredentialType="Windows"  />
            </security>
          </binding>
        </netTcpBinding>
      </bindings>
      <services>

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

      </services>
      <behaviors>
        <serviceBehaviors>
          <behaviorname="MyBehavior" >
            <serviceMetadatahttpGetEnabled="false"/>
            <serviceDebugincludeExceptionDetailInFaults="true" />
            <dataContractSerializermaxItemsInObjectGraph="6553600"/>
          </behavior>
        </serviceBehaviors>
      </behaviors>
      <serviceHostingEnvironmentmultipleSiteBindingsEnabled="true" />
    </system.serviceModel>

  <system.webServer>
    <modulesrunAllManagedModulesForAllRequests="true"/>
  </system.webServer></configuration>

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

 

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

 

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

 

本文標題:WCF4.0安裝NET.TCP啟用及常見問題
本文路徑:http://m.2m8n56k.cn/article22/jjdcjc.html

成都網站建設公司_創新互聯,為您提供全網營銷推廣關鍵詞優化網站營銷虛擬主機定制開發

廣告

聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:[email protected]。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯

h5響應式網站建設
主站蜘蛛池模板: 久久久久国产成人精品 | 成年免费a级毛片 | 久久视频这里只精品3国产 久久视频这里只有精品 | 日韩视频在线观看中字 | 新久草视频 | 99久久国产综合精品成人影院 | 中文字幕有码在线视频 | 亚色成人 | 亚洲国产欧美在线成人aaaa | 一区二区国产精品 | 99精彩视频 | 欧美男人操女人 | 亚洲 欧美 成人日韩 | 国产三级日产三级韩国三级 | 午夜免费的国产片在线观看 | 大伊香蕉精品视频在线 | 国产欧美日韩在线 | 亚洲欧美综合国产不卡 | 九色视频在线观看免费 | 亚洲一区免费在线 | 亚洲日本欧美综合在线一 | 国产一国产a一级毛片 | 中文字幕中文字幕中中文 | 亚洲一级特黄特黄的大片 | 91碰碰 | 日本黄色毛片 | 在线播放高清国语自产拍免费 | 国产精品免费视频一区一 | 天天欲色成人综合网站 | 国产资源在线免费观看 | 午夜精品久久久久久91 | 久久久久久国产视频 | 国产玖玖在线观看 | 欧美日韩亚洲一区二区三区在线观看 | 精品国产一区二区三区久久 | 日本一区二区三区精品视频 | 欧美精品成人一区二区视频一 | 久久精品夜色国产 | 5388国产亚洲欧美在线观看 | 欧美三级黄 | 伊人久爱 |