Porting WCF dall'auto-hosting all'hosting IIS/AppFabric
-
27-10-2019 - |
Domanda
Ho un WCF che ha un legame TCP, HTTP e MEX in un file autosufficiente e tutto funziona alla grande. Tuttavia, e voglio migrarlo su AppFabric e mantenere gli stessi legami, ma sto facendo fatica a farlo. Ho aggiunto l'applicazione di servizio WCF, ho corretto il file SVC, rilascia l'applicazione della console di auto-hosting, ma continuo a ottenere il terribile Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http]
. errore. Quali modifiche dovrei promuovere dal mio app.config al mio file web.config per far funzionare questo? Non ho nemmeno provato a pubblicarlo su IIS, ancora ... questo errore che sto ricevendo è dal server web di VS
Di seguito è riportato il mio precedente file app.config per l'auto-hosting:
<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>
Cosa devo cambiare?
Tks
Soluzione
Solo IIS non è in grado di ospitare endpoint non HTTP. È inoltre necessario installare (Attiva funzionalità) Windows Activation Service (WAS). Una volta installato è necessario abilitare l'associazione net.tcp per il tuo sito nella console di gestione IIS.