我有两个服务,通过配置文件配置。他们每个人都听一个http和一个https地址。问题是如何配置端口。如果我配置HTTP端口相同的值和HTTPS端口到另一个值,调试,整个项目我得到了WCF服务主机以下错误消息时:WCF端口配置错误
状态:错误 System.ServiceModel.AddressAlreadyInUseException: HTTP无法注册URL https://+:8002/Services/xxxService/ 因为TCP端口8002正在被另一个应用程序 使用。 ---> System.Net.HttpListenerException:如果我配置了四个端口(HTTP和HTTPS)有不同的价值观,没有因为 它正被另一个进程使用
的 进程无法访问该文件的https值是在IIS中配置和认证的ssl端口的值,服务调用时出现以下异常(但这两项服务均在WCF服务主机中启动):
发生错误 HTTP请求至 https://localhost:8000/Services/yyyService/。 这可能是由于以下事实: 服务器证书未在HTTPS 的情况下正确使用HTTP.SYS配置为 。这也可能是由客户端和服务器之间的安全绑定 的 不匹配造成的。
如果我将第一个服务配置为使用SSL端口(443),那么只会启动第二个服务(具有“错误”https端口的服务)。服务为先再次出现错误信息是:
System.ServiceModel.AddressAlreadyInUseException:因为TCP端口443正在使用由 另一个应用程序 HTTP不能注册网址 https://+:443/Services/xxxService/ 。 ---> System.Net.HttpListenerException:因为 它正在被另一个进程使用
在此之上的 进程无法访问该文件,我得到一个异常,拨打第二服务时:
将 HTTP请求设置为 https://localhost/Services/yyyService/时发生错误。 这可能是由于以下事实: 服务器证书未在HTTPS 的情况下正确使用HTTP.SYS配置为 。这也可能是由客户端和服务器之间的安全绑定 的 不匹配造成的。
当我将两个服务都配置为使用https:https:/// 443时,那么没有任何东西可以开始。而且我会遇到各种奇怪的异常 - clientcredentials是只读的,握手会遇到意想不到的包格式,有关远程地址等等。
我已经在网络中配置了这两个地址。配置如下:
<baseAddresses>
<add baseAddress="http://localhost:port1/Services/xxxService/" />
<add baseAddress="https://localhost:port2/Services/xxxService/" />
</baseAddresses>
[...]
<baseAddresses>
<add baseAddress="http://localhost:port3/Services/yyyService/" />
<add baseAddress="https://localhost:port4/Services/yyyService/" />
</baseAddresses>
我一直在试图运行这件事情两天了,所以任何地方将不胜感激。
PS。在Visual Studio中,我将IIS配置为开发服务器,而不是内置的Visual Studio Web开发服务器。
编辑:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service name="namespace.xxxService"
behaviorConfiguration="default">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/Services/xxxService/" />
<add baseAddress="https://localhost:8001/Services/xxxService/" />
</baseAddresses>
</host>
<endpoint address=""
binding="wsHttpBinding"
bindingConfiguration="defaultWsHttpBinding"
contract="namespace.IxxxService" />
<endpoint address="mex/"
binding="mexHttpBinding"
contract="IMetadataExchange"
bindingConfiguration="" />
</service>
<service name="namespace.yyyService" behaviorConfiguration="default">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8003/Services/yyyService/" />
<add baseAddress="https://localhost:8004/Services/yyyService/" />
</baseAddresses>
</host>
<endpoint address=""
binding="wsHttpBinding"
bindingConfiguration="defaultWsHttpBinding"
contract="namespace.IyyyService" />
<endpoint address="mex/"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<client>
<endpoint address="https://localhost:8001/Services/xxxService/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IxxxService"
contract="namespace.IxxxService" name="WSHttpBinding_IxxxService" />
<endpoint address="https://localhost:8001/Services/yyyService/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IyyyService"
contract="namespace.IyyyService" name="WSHttpBinding_IyyyService" />
</client>
<behaviors>
<serviceBehaviors>
<behavior name="default">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="MembershipProvider"
membershipProviderName="SqlMembershipProvider" />
</serviceCredentials>
<serviceAuthorization principalPermissionMode="UseAspNetRoles"
roleProviderName="SqlRoleProvider" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="defaultWsHttpBinding">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName" />
<transport clientCredentialType="None" />
</security>
</binding>
<binding name="WSHttpBinding_IyyyService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false" >
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
<binding name="WSHttpBinding_IxxxService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
您能否发布您的整个/配置部分?这将是非常有益的 - 谢谢! –
2009-07-06 12:28:36