1

我有一个 WCF,它在自托管文件中具有 TCP、HTTP 和 Mex 绑定,并且一切正常。但是,我想将它迁移到 AppFabric,并保持相同的绑定,但我很难做到这一点。我添加了 WCF 服务应用程序,更正了 svc 文件,删除了自托管控制台应用程序,但我不断收到糟糕的Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http]. 错误。我应该从我的 app.config 到我的 web.config 文件进行哪些更改才能使其正常工作?我什至还没有尝试在 IIS 上发布它,但是......我得到的这个错误来自 VS 的网络服务器
下面是我以前的自托管 app.config 文件:

<configuration>
  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
      <bindings>
        <basicHttpBinding>
          <binding name="SimpleBinding" />
        </basicHttpBinding>
        <netTcpBinding>
          <binding name="DefaultTCPBinding" closeTimeout="01:00:00" receiveTimeout="01:00:00"
                sendTimeout="01:00:00" transactionFlow="true" transactionProtocol="OleTransactions"
                maxBufferSize="5242880" maxReceivedMessageSize="5242880">
            <reliableSession inactivityTimeout="01:00:00" />
          </binding>
        </netTcpBinding>
        <wsHttpBinding>
          <binding name="RSAlarmEvent" closeTimeout="00:01:00" openTimeout="00:01:00"
              receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
              transactionFlow="false" hostNameComparisonMode="StrongWildcard"
              maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
              messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
              allowCookies="false">
            <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                maxBytesPerRead="4096" maxNameTableCharCount="16384" />
            <reliableSession ordered="true" inactivityTimeout="00:10:00"
                enabled="false" />
            <security mode="Message">
              <transport clientCredentialType="Windows" proxyCredentialType="None"
                  realm="" />
              <message clientCredentialType="Windows" negotiateServiceCredential="true"
                  algorithmSuite="Default" />
            </security>
          </binding>
        </wsHttpBinding>
        <webHttpBinding>
          <binding name="ScriptBindig" crossDomainScriptAccessEnabled="true" />
        </webHttpBinding>
      </bindings>
      <behaviors>
        <endpointBehaviors>
          <behavior name="WebScriptBehavior">
            <enableWebScript />
          </behavior>
        </endpointBehaviors>
        <serviceBehaviors>
          <behavior name="MetadataBehavior">
            <serviceMetadata httpGetEnabled="true" httpGetBinding="webHttpBinding"
                  httpGetBindingConfiguration="" />
            <serviceDebug includeExceptionDetailInFaults="true" />
            <serviceThrottling maxConcurrentCalls="64" maxConcurrentSessions="400"
                  maxConcurrentInstances="464" />
          </behavior>
        </serviceBehaviors>
      </behaviors>
      <services>
        <service behaviorConfiguration="MetadataBehavior" name="MyServer.Implementation.MyAppImplementation">
          <endpoint address="" binding="netTcpBinding" bindingConfiguration="DefaultTCPBinding"
                name="MyAppTCPEndpoint" contract="MyServer.Interfaces.IMyApp" />
          <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
                name="MyAppMex" contract="IMetadataExchange" />
          <endpoint address="ws" behaviorConfiguration="" binding="basicHttpBinding"
                bindingConfiguration="SimpleBinding" name="MyApp" contract="MyServer.Interfaces.IMyApp" />
          <host>
            <baseAddresses>
              <add baseAddress="net.tcp://desk01:9878/MyAppService" />
              <add baseAddress="http://desk01:9876/MyAppService/" />
            </baseAddresses>
          </host>
        </service>
      </services>
      <diagnostics>
      <messageLogging logEntireMessage="true"
                      logMalformedMessages="true"
                      logMessagesAtTransportLevel="true" />
    </diagnostics>
  </system.serviceModel>
</configuration>

我需要改变什么?
Tks

4

1 回答 1

3

IIS alone is not able to host non HTTP endpoints. You must also install (activate feature) Windows Activation Service (WAS). Once installed you must enable net.tcp binding for your site in IIS management console.

于 2011-03-18T21:43:35.707 回答