Hosten eines WCF-Dienst mit Net.TCP

Ich bin Total neu hier und versuche zu host die einfachste WCF-Dienst mit net.tcp-Bindung
Ich habe Windows 7 Professional und IIS7 und aktiviert haben, die NICHT-http-Aktivierung.

  • Ich starten Sie eine neue WCF-Dienstanwendung
    Projekt in vs2010 und kompilieren Sie es.
    NOHTING ANDERES!
  • Lösche ich alle meine IIS
    Websites, und fügen Sie eine neue namens WCFHost
  • Ich öffnen WcfTestClient.exe und fügt
    http://localhost/Service1.svc die Anwendung findet es

Web.config sieht wie folgt aus (unbearbeitet)

 <system.serviceModel>
    <services>
      <service name="WcfService2.Service1" behaviorConfiguration="WcfService2.Service1Behavior">
        <endpoint address="" binding="wsHttpBinding" contract="WcfService2.IService1">
          <!-- 
              Upon deployment, the following identity element should be removed or replaced to reflect the 
              identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
              automatically.
          -->
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WcfService2.Service1Behavior">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

So weit, So gut. Aber was über das Netz.tcp-Bindung. Ich füge die "enabledProtocols" - Attribut so meine applicationHost.config sieht wie folgt aus

       <site name="WCFHOST" id="3">
            <application path="/" applicationPool="WCFHOST" enabledProtocols="http,net.tcp,net.pipe,net.msmq">
                <virtualDirectory path="/" physicalPath="C:\Prosjekter\temp\TestService\TestService" />
            </application>
            <bindings>
                <binding protocol="net.tcp" bindingInformation="808:*" />
                <binding protocol="http" bindingInformation="*:80:" />
            </bindings>
        </site>

Dann geh ich zum IIS WCFHost website und fügen Sie verbindlich net.tcp-808:*
Und dann habe ich ändern Sie meine web.config für den WCF-Dienst wie folgt Aussehen. (wurde nur die Bindung auf die Endpunkte)

<system.serviceModel>
    <services>
      <service name="WcfService2.Service1" behaviorConfiguration="WcfService2.Service1Behavior">
        <!-- Service Endpoints -->
        <endpoint address="" binding="netTcpBinding" contract="WcfService2.IService1">
          <!-- 
              Upon deployment, the following identity element should be removed or replaced to reflect the 
              identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
              automatically.
          -->
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WcfService2.Service1Behavior">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
 </system.serviceModel>

Wenn ich jetzt versuche, um die service-net.tcp://localhost:808/Service1.svc in meinem WcfTestClient.exe ich bekomme die Fehlermeldung

Fehler: Nicht-abrufen von Metadaten aus dem Netz.tcp://localhost/Service1.svc
TCP-Fehlercode 10061: es konnte Keine Verbindung hergestellt werden, da der Zielcomputer aktiv verweigert.... 127.0.0.1:808

Meine firewall ausgeschaltet ist.
Ich haben gesehen eine Sache,, obwohl.. wenn mit netstat-a die 808-port dort nicht aufgeführt ist.. sollte es?

Kann mir jemand helfen, erstelle gerade meinen ersten WCF service mit nettcp binding?

InformationsquelleAutor Martin | 2011-07-08
Schreibe einen Kommentar