【发布时间】:2009-10-19 01:56:27
【问题描述】:
我正在使用由 wsdl 生成的接口,并且在尝试将我的服务托管为 Windows 服务时遇到了问题。
下面一行出现在界面上方。除非我把它改成
[System.ServiceModel.ServiceContractAttribute(Namespace="http://xxxxxx.com/", ConfigurationName="IService")]
到
[System.ServiceModel.ServiceContract]
我无法启动托管我的程序的 Windows 服务(事件查看器中的错误日志显示在 Service 实施的合同列表中找不到合同 IService。)我正在列出我的应用程序的端点。配置文件如下:
endpoint address=""
binding="basicHttpBinding"
contract="Service.IService"
当我将合同更改为“http://xxxxxxx.com/IService”时也会发生这种情况,因为它出现在 ServiceContractAttribute 中。关于如何解决此问题的任何想法?
配置文件的服务部分:
<service name="Service.Service"
behaviorConfiguration="myServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/Service"/>
</baseAddresses>
</host>
<endpoint address=""
binding="basicHttpBinding"
contract="Service.IService" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="Service.IService" />
</service>
<behaviors>
<serviceBehaviors>
<behavior name="myServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
【问题讨论】:
-
这听起来不像是端点配置问题,而是服务配置问题。您的属性提到了 ConfigurationName="IService":您可以发布 app.config
元素的 name="IService" 吗?