2012-03-15 22 views
1

私はWcfサービスプロジェクトを持っています。私のweb.configファイル内system.serviceModelタグがある:私はセルフホスティングサービスのために作成したいときエンドポイントのscheme net.tcpに一致するベースアドレスを見つけることができませんでした

<system.serviceModel> 
    <bindings> 
     <netTcpBinding> 
     <binding name="RCISPNetTcpBinding" openTimeout="00:10:00" sendTimeout="00:10:00"> 
      <security mode="Transport"> 
      <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign"> 
      </transport> 
      <message clientCredentialType="Windows"/> 
      </security> 
     </binding> 
     </netTcpBinding> 
    </bindings> 

    <services> 
     <service behaviorConfiguration="RCISP.WcfServiceBehaviour" name="RCISP.WcfService.PersonWcfService"> 
     <endpoint address="PersonServices" binding="netTcpBinding" bindingConfiguration="RCISPNetTcpBinding" 
      contract="RCISP.Common.ServiceContract.IPersonService" > 
      <identity> 
      <dns value="localhost" /> 
      </identity> 
     </endpoint> 
     <host> 
      <baseAddresses> 
      <add baseAddress="net.tcp://localhost:40003/"/> 
      </baseAddresses> 
     </host> 
     </service> 
    </services> 

    <behaviors> 
     <serviceBehaviors> 
     <behavior name="RCISP.WcfServiceBehaviour"> 
      <serviceMetadata httpGetEnabled="false" /> 
      <serviceDebug includeExceptionDetailInFaults="false" /> 
      <serviceAuthorization principalPermissionMode="UseWindowsGroups" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 

私はランタイムエラーを持っています。例外の

public class ServiceFactory : ServiceHostFactory 
    { 
     protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses) 
     { 
      if (!IsInitialised) InitialiseService(); 
      return base.CreateServiceHost(serviceType, baseAddresses); 
     } 

    } 

メッセージは次のとおりです。

Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http].

なぜ?

+0

http://stackoverflow.com/questions/1793119をチェック/ could-not-find-a-base-address-that-matches-scheme-net-tcp –

+0

@wise_guybg:私はその質問を読んだが問題は解決しなかった。 – Ehsan

答えて

1

「net.tcp」プロトコルが何であるかを伝えるために、設定ファイルにプロトコルマッピングを追加する必要があります。右あなたの<bindings>セクションの後にこれを追加します。

<protocolMapping> 
    <add scheme="net.tcp" binding="netTcpbinding"/> 
</protocolMapping>  
+0

私はそれを追加しますが、私の問題は解決しません。 – Ehsan

2

はあなたが自己(自分自身のプロセス内)のサービスをホスティングしているが、私はあなたがWebアプリケーションの内部で、それをホストしようとしていると思います上記のコードに基づいていたと述べました。その場合、Visual StudioのWebサーバーはnet.tcpエンドポイントをホストできません。 IISで実行するようにプロジェクトを設定する必要があります。 hereの指示に従ってください。

あなたは本当にあなたがそれを持って正確にどのような構成のままにし、次のコードを使用してサービスをスピンアップすることができるよりもセルフホスティングしている場合:

var host = new ServiceHost(typeof(Service1)); 
host.Open(); 
関連する問題