L'hébergement d'un service WCF avec Net.TCP

Je suis totalement nouveau à cela et essayer d'hôte le plus simple de service WCF avec un filet.tcp liaison
J'ai Windows 7 Professionnel et IIS7 et ont permis à la NON activation http.

  • Je commence une nouvelle application de Service WCF
    projet dans vs2010 et le compiler.
    NOHTING AUTRE!!!!
  • J'ai supprimer tous mes IIS
    Les sites web et ajouter un nouveau appelée WCFHost
  • J'ouvre WcfTestClient.exe et ajoute
    http://localhost/Service1.svc l'application trouve

Le Web.config ressemble à ceci (vierge)

 <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>

Donc bon. Mais qu'en net.tcp de liaison. J'ai ajouté le "enabledProtocols" attribut donc mon applicationHost.config ressemble à ceci

       <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>

Puis-je aller à l'IIS WCFHost site web et ajouter une liaison nette.tcp 808:*
Puis-je modifier mon site web.config pour le Service WCF ressembler à ça. (juste changé la liaison sur les systèmes d'extrémité)

<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>

Quand j'essaie maintenant d'ajouter le service net.tcp://localhost:808/Service1.svc dans mon WcfTestClient.exe je reçois le message d'erreur

Erreur: Impossible d'obtenir les Métadonnées à partir de net.tcp://localhost/Service1.svc
TCP-code d'erreur 10061: Aucune connexion n'a pu être établie car l'ordinateur cible l'a expressément refusé.... 127.0.0.1:808

Mon pare-feu est désactivé.
J'ai vu une chose, mais.. quand à l'aide de la commande netstat -a la 808 port n'est pas listé ici..?

Quelqu'un peut-il m'aider juste de créer mon premier service WCF avec nettcp de liaison?

OriginalL'auteur Martin | 2011-07-08