[英]WCF Endpoint Issues
我在VB中有一個WCF,它將在Windows Service中托管。 我管理了安裝程序,以便實際上安裝了該服務。 但是,當我嘗試啟動服務時,出現以下錯誤:
“本地計算機上的服務已啟動,然后停止。某些服務如果沒有工作要做,則會自動停止,例如,性能日志和警報服務。”
輕觸事件查看器會給我以下內容:
服務無法啟動。 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
由於您是自托管主機,因此需要指定一個地址以供您的服務監聽。 如果您托管在IIS中,則IIS將控制地址,但是在自托管方案中,必須在此配置元素中提供該地址:
<endpoint address="" binding="wsHttpBinding" contract="ExStreamWCF.IService1">
將基地址添加為:
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost/ExStreamWCF" />
</baseAddresses>
</host>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.