【问题标题】:WCF Endpoint IssuesWCF 端点问题
【发布时间】:2011-05-10 17:48:36
【问题描述】:

我在 VB 中有一个 WCF,它将托管在 Windows 服务中。我管理了安装程序,以便实际安装服务。但是,当我尝试启动服务时,出现以下错误:

“本地计算机上的服务启动然后停止。某些服务在没有工作时会自动停止,例如,性能日志和警报服务。”

检查事件查看器给了我以下信息:

服务无法启动。 System.InvalidOperationException:找不到与具有绑定 WSHttpBinding 的端点的方案 http 匹配的基地址。注册的基地址方案是 []。在……在……在……

我猜这会把我的问题放在这里的某个地方:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
    <sources>
        <!-- This section defines the logging configuration for My.Application.Log -->
        <source name="DefaultSource" switchName="DefaultSwitch">
            <listeners>
                <add name="FileLog"/>
                <!-- Uncomment the below section to write to the Application Event Log -->
                <!--<add name="EventLog"/>-->
            </listeners>
        </source>
    </sources>
    <switches>
        <add name="DefaultSwitch" value="Information" />
    </switches>
    <sharedListeners>
        <add name="FileLog"
             type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" 
             initializeData="FileLogWriter"/>
        <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
        <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
    </sharedListeners>
</system.diagnostics>


  <system.serviceModel>
<services>
  <service name="ExStreamWCF.Service1" behaviorConfiguration="ExStreamWCF.Service1Behavior">
    <!-- Service Endpoints -->
    <endpoint address="" binding="wsHttpBinding" contract="ExStreamWCF.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="ExStreamWCF.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>



</configuration>

但是,作为一个菜鸟,我不知道可能出了什么问题。这对我来说真的很新鲜。任何方向将不胜感激!

谢谢, 杰森

fdsa

【问题讨论】:

    标签: vb.net wcf deployment service


    【解决方案1】:

    添加基地址为:

    <host>          
      <baseAddresses>            
        <add baseAddress="net.tcp://localhost/ExStreamWCF" /> 
      </baseAddresses>        
    </host>
    

    【讨论】:

      【解决方案2】:

      由于您是自托管的,因此您需要指定一个地址供您的服务监听。如果您托管在 IIS 中,则 IIS 控制地址,但在自托管方案中,您必须在此配置元素中提供地址:

      <endpoint address="" binding="wsHttpBinding" contract="ExStreamWCF.IService1">
      

      【讨论】:

        猜你喜欢
        • 2012-05-16
        • 1970-01-01
        • 2013-04-11
        • 1970-01-01
        • 1970-01-01
        • 2012-02-28
        • 2011-07-06
        • 1970-01-01
        • 2011-09-19
        相关资源
        最近更新 更多