开发者

WCF Endpoint Issues

开发者 https://www.devze.com 2023-03-05 02:39 出处:网络
I have a WCF in VB which is开发者_开发技巧 to be hosted in a Windows Service. I managed the install program so the service actually installs. But, when I try to start the service, I get the following

I have a WCF in VB which is开发者_开发技巧 to be hosted in a Windows Service. I managed the install program so the service actually installs. But, when I try to start the service, I get the following error:

"The service on Local Computer started and then stopped. Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service."

Cheking the Event Viewer gives me the following:

Service cannot be started. System.InvalidOperationException: Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding. Registered base address schemes are []. at... at... at...

Which, I am guessing, would put my problem somewhere in here:

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

However, as a total noob I have no idea what could possible be wrong. This is all really new to me. Any direction would be greatly appreciated!

Thanks, Jason

fdsa


add baseaddress as:

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


Since you are self-hosting you need to specify an address for your service to listen on. If you are hosted in IIS, IIS controls the address, but in self-hosted scenarios, you have to provide the address, in this configuration element:

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

精彩评论

暂无评论...
验证码 换一张
取 消