我通过无文件激活在XP上的IIS中托管服务。当没有为IIS启用SSL端口时,服务启动正常但是当启用SSL端口时,我收到错误消息:
System.ServiceModel.ServiceActivationException:由于编译期间发生异常,无法激活服务'/SkillsPrototype.Web/services/Linkage.svc'。异常消息是:绑定实例已与侦听URI“http://rcollet.hsb-corp.hsb.com/SkillsPrototype.Web/Services/Linkage.svc”关联。如果两个端点想要共享相同的ListenUri,则它们还必须共享相同的绑定对象实例。两个冲突的端点要么在AddServiceEndpoint()调用中,在配置文件中指定,要么在AddServiceEndpoint()和config的组合中指定。 。 ---> System.InvalidOperationException:绑定实例已与监听URI“http://rcollet.hsb-corp.hsb.com/SkillsPrototype.Web/Services/Linkage.svc”关联。如果两个端点想要共享相同的ListenUri,则它们还必须共享相同的绑定对象实例。两个冲突的端点在AddServiceEndpoint()调用,配置文件或AddServiceEndpoint()和config的组合中指定。
我的服务模型配置是
<system.serviceModel>
<diagnostics wmiProviderEnabled="true">
<messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxMessagesToLog="3000"/>
</diagnostics>
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" />
</webHttpEndpoint>
</standardEndpoints>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding>
<security mode="None">
<transport clientCredentialType="None"/>
</security>
</binding>
</webHttpBinding>
</bindings>
<protocolMapping>
</protocolMapping>
<services>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="false">
<serviceActivations>
<clear/>
<add factory="System.ServiceModel.Activation.WebScriptServiceHostFactory" service="SkillsPrototype.ServiceModel.Linkage" relativeAddress="~/Services/Linkage.svc"/>
</serviceActivations>
</serviceHostingEnvironment>
</system.serviceModel>
当您查看svclog文件时,启用SSL时会返回两个基本地址,一个用于http,另一个用于https。我怀疑这是问题的一部分,但我不确定如何解决它。
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>524333</EventID>
<Type>3</Type>
<SubType Name="Information">0</SubType>
<Level>8</Level>
<TimeCreated SystemTime="2010-06-16T17:40:55.8168605Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{95927f9a-fa90-46f4-af8b-721322a87aaa}" />
<Execution ProcessName="aspnet_wp" ProcessID="1888" ThreadID="5" />
<Channel/>
<Computer>RCOLLET</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Information">
<TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.ServiceHostBaseAddresses.aspx</TraceIdentifier>
<Description>ServiceHost base addresses.</Description>
<AppDomain>/LM/w3svc/1/ROOT/SkillsPrototype.Web-1-129211836532542949</AppDomain>
<Source>System.ServiceModel.WebScriptServiceHost/49153359</Source>
<ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/CollectionTraceRecord">
<BaseAddresses>
<Address>http://rcollet.hsb-corp.hsb.com/SkillsPrototype.Web/Services/Linkage.svc</Address>
<Address>https://rcollet.hsb-corp.hsb.com/SkillsPrototype.Web/Services/Linkage.svc</Address>
</BaseAddresses>
</ExtendedData>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
</E2ETraceEvent>
由于帖子上的字符限制,我无法发布完整的服务日志。
答案 0 :(得分:3)
在花了好几个小时之后我会在发布后不久解决问题。
问题似乎与使用WebScriptServiceHostFactory有关。相反,我创建了一个带有kind属性的服务条目,现在它可以工作。
以下是更正后的配置
<system.serviceModel>
<diagnostics wmiProviderEnabled="true">
<messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxMessagesToLog="3000"/>
</diagnostics>
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" />
</webHttpEndpoint>
</standardEndpoints>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<!--Default settings for the webHttpBinding-->
<binding>
<security mode="None">
<transport clientCredentialType="None"/>
</security>
</binding>
</webHttpBinding>
</bindings>
<protocolMapping>
</protocolMapping>
<services>
<service name="SkillsPrototype.ServiceModel.Linkage">
<endpoint
kind="webScriptEndpoint"
contract="SkillsPrototype.ServiceModel.ILinkage"/>
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="false">
<serviceActivations>
<clear/>
<add service="SkillsPrototype.ServiceModel.Linkage" relativeAddress="~/Services/Linkage.svc"/>
</serviceActivations>
</serviceHostingEnvironment>
</system.serviceModel>