简体   繁体   English

找不到与端点的scheme net.tcp匹配的基址

[英]Could not find a base address that matches scheme net.tcp for the endpoint

I have a Wcf Service project. 我有一个Wcf服务项目。 system.serviceModel tag in my web.config is : 我的web.config中的system.serviceModel标记是:

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

I have a runtime error when I want create self-hosting for service. 当我想要为服务创建自托管时,我有一个运行时错误。

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

    }

Message of Exception is : 异常消息是:

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

Why? 为什么?

You said you were self hosting the service (within your own process) but based on the code above I think you're trying to host it inside of a web application. 你说你是自己托管服务(在你自己的过程中),但根据上面的代码,我认为你试图在Web应用程序内托管它。 If so Visual Studio's web server can not host a net.tcp end point. 如果是这样,Visual Studio的Web服务器无法承载net.tcp端点。 You'll need to set the project up to run under IIS. 您需要将项目设置为在IIS下运行。 Please follow the instructions here . 请按照此处的说明操作。

If you are truly self hosting than you can leave the configuration exactly how you have it and spin up the service using the following code: 如果您真的是自托管,那么您可以完全按照配置保留配置,并使用以下代码启动服务:

var host = new ServiceHost(typeof(Service1));
host.Open();

You need to add a protocol mapping to your configuration file to tell it what the "net.tcp" protocol is. 您需要将协议映射添加到配置文件中,以告诉它“net.tcp”协议是什么。 Right after your <bindings> section add this: <bindings>部分之后添加以下内容:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到与方案 net.tcp 匹配的基地址 - Could not find a base address that matches scheme net.tcp 例外:找不到与方案net.tcp匹配的基址 - Exception: Could not find a base address that matches scheme net.tcp 找不到与绑定MetadataExchangeTcpBinding自托管端点的终结点计算机匹配方案net.tcp的基地址 - Could not find a base address that matches scheme net.tcp for the endpoint with binding MetadataExchangeTcpBinding self hosting 找不到与绑定 NetTcpBinding 的端点的方案 net.tcp 匹配的基地址。 基地址方案是 [http] - Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Base address schemes are [http] 找不到与绑定BasicHttpBinding的端点的方案https匹配的基址 - Could not find a base address that matches scheme https for the endpoint with binding BasicHttpBinding 找不到与绑定BasicHttpBinding的端点匹配方案http的基地址 - Could not find a base address that matches scheme http for the endpoint with binding BasicHttpBinding 找不到与绑定WSHttpBinding的端点的scheme http匹配的基址 - Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding WCF 异常:找不到与端点的方案 http 匹配的基地址 - WCF Exception: Could not find a base address that matches scheme http for the endpoint 找不到与绑定WSHttpBinding的端点匹配方案http的基地址。 注册的基址方案为[https] - Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding. Registered base address schemes are [https] 找不到与绑定BasicHttpBinding的端点匹配方案https的基地址。 注册的基址方案是http - Could not find a base address that matches scheme https for the endpoint with binding BasicHttpBinding. Registered base address schemes are http
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM