我收到此错误: 此集合已包含方案http的地址。此集合中每个方案最多只能有一个地址。如果您的服务是在IIS中托管的,则可以通过将'system.serviceModel / serviceHostingEnvironment / multipleSiteBindingsEnabled'设置为true或指定'system.serviceModel / serviceHostingEnvironment / baseAddressPrefixFilters'来解决问题。
如果我设置< serviceHostingEnvironment multipleSiteBindingsEnabled =“true”/>然后我得到这个错误:
在配置中将'system.serviceModel / serviceHostingEnvironment / multipleSiteBindingsEnabled'设置为true时,端点需要指定相对地址。如果要在端点上指定相对侦听URI,则地址可以是绝对的。要解决此问题,请为端点
指定相对uri好的,我的问题是这个,如果我从配置文件中完全删除整个部分,我仍然收到第一个错误。意味着IIS认为在配置文件中没有任何东西时我有多个端点。 我在Windows 2012服务器(iis 8)上安装了新的IIS,asp.net页面托管得很好。该应用程序在Windows 7和Windows 2003服务器(iis 6)上运行良好。
这是配置文件的服务模型部分:
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<service behaviorConfiguration="metadataSupport_Behaviour" name="myserver.Service.Gateway">
<host>
<baseAddresses>
<add baseAddress="http://www.myserver.com.au/Service/"/>
</baseAddresses>
</host>
<endpoint binding="basicHttpBinding" bindingConfiguration="basicHttpBinding_Configuration_NoSecurity" contract="myserver.Service.IGateway"
address="Gateway.svc" listenUri="http://www.myserver.com.au/Service/Gateway.svc">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange">
</endpoint>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding_Configuration_NoSecurity" receiveTimeout="23:10:00" sendTimeout="23:10:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32000" maxStringContentLength="8192000" maxArrayLength="16384000" maxBytesPerRead="1024000" maxNameTableCharCount="16384000" />
<security mode="None">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="metadataSupport_Behaviour">
<serviceMetadata httpGetEnabled="true" httpGetUrl="http://www.myserver.com.au/Service/Gateway.svc" httpsGetEnabled="true"
httpsGetUrl="https://www.myserver.com.au/Service/Gateway.svc"/>
<serviceDebug includeExceptionDetailInFaults="true" httpHelpPageEnabled="false" httpsHelpPageEnabled="false"/>
</behavior>
<behavior name="basicHttp_ServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
请帮忙!
答案 0 :(得分:1)
确定设法通过完全删除所有servicemodel部分并将其替换为此来使其工作:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="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>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
以上是新创建的.net 4.5 WCF IIS托管服务的默认服务配置。这意味着我必须添加/编辑这些:
<httpRuntime targetFramework="4.5"/>
<compilation targetFramework="4.5"/>