Wcf &引用;“URI”的注册已存在;为HTTPS和HTTP托管相同服务时
我正在尝试使用两个端点(一个是HTTP,另一个是HTTPS)在同一个网站内托管相同的服务 问题是我可以愉快地调用一个服务(无论我先调用哪个服务都有效),但调用另一个服务失败,直到我重新设置并重试。因此,我可以很高兴地一次只调用一个,直到流程回收。 我已经用尽了(或者我想我已经有了)我能找到的所有相关问答和文件,但似乎没有一个对我有帮助。MSDN关于这些案例的文档水平(这应该是非常常见的)令人震惊,没有任何东西像它看起来那样有效 我使用Host/BaseAddresses/BaseAddress时运气不佳,每当我使用它时,就会出现另一个错误(找不到HTTPS方案) 我有一个名为Secure的文件夹,它在IIS中启用了HTTPS 我已禁用mex,因此不允许元数据,我已通过以前的错误 有人有线索吗?我没有俱乐部Wcf &引用;“URI”的注册已存在;为HTTPS和HTTP托管相同服务时,wcf,http,iis,binding,https,Wcf,Http,Iis,Binding,Https,我正在尝试使用两个端点(一个是HTTP,另一个是HTTPS)在同一个网站内托管相同的服务 问题是我可以愉快地调用一个服务(无论我先调用哪个服务都有效),但调用另一个服务失败,直到我重新设置并重试。因此,我可以很高兴地一次只调用一个,直到流程回收。 我已经用尽了(或者我想我已经有了)我能找到的所有相关问答和文件,但似乎没有一个对我有帮助。MSDN关于这些案例的文档水平(这应该是非常常见的)令人震惊,没有任何东西像它看起来那样有效 我使用Host/BaseAddresses/BaseAddress时
<service name="Namespace.MyService" behaviorConfiguration="MyBehaviour">
<host>
<baseAddresses>
</baseAddresses>
</host>
<endpoint address="http://localhost/Services/MyService.svc/MyService"
name="MyService" binding="wsHttpBinding"
bindingConfiguration="myWsHttpBinding" contract="Namespace.IMyService" />
<endpoint address="https://localhost/Services/Secure/MySslService.svc/MySslService"
name="MySslService" binding="basicHttpBinding"
bindingConfiguration="MySslServiceBinding" contract="Namespace.IMyService" />
</service>
原始错误为:
URI的注册已存在
'http://localhost/Services/...."
描述:未处理的异常
在执行过程中发生
当前web请求。请检查
有关堆栈跟踪的详细信息,请参阅
错误及其来源
密码
例外情况详情:
System.InvalidOperationException:A
URI的注册已存在
'http://localhost/Services/...."
源错误:
生成了一个未处理的异常
在执行当前
网络请求。有关
例外的来源和位置
可以使用异常来识别
堆栈跟踪如下
堆栈跟踪:
[无效操作例外:A
URI的注册已存在System.ServiceModel.Channels.UriPrefixTable
1.RegisterUri(Uri
uri,主机名ComparisonMode
hostNameComparisonMode,TItem项)
+320 System.ServiceModel.Channel.HttpTransportManager.Register(TransportChannelListener
信道侦听器)+380
System.ServiceModel.Channel.TransportManager.Open(TransportChannelListener
channelListener)+816
System.ServiceModel.Channel.TransportManagerContainer.Open(选择TransportManagersCallback)
选择TransportManagerCallback)+121
System.ServiceModel.Channels.HttpChannelListener.OnOpen(TimeSpan
超时)+125
System.ServiceModel.Channel.CommunicationObject.Open(时间跨度
超时)+789
System.ServiceModel.Channels.DatagramChannelDemuxer
2.OnOuterListenerOpen(ChannelDemuxerFilter
过滤器,IChannelListener侦听器,
TimeSpan超时)+606System.ServiceModel.Channel.SingletonChannelListener`3.OnOpen(TimeSpan 超时)+91
System.ServiceModel.Channel.CommunicationObject.Open(时间跨度 超时)+789
System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan 超时)+375 以下是WCF跟踪日志错误: 频道调度员在 'http://localhost/Services/...“带着 合同“IMyService”无法生效 打开它的IChannelListener。 System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan 超时) System.ServiceModel.Channel.CommunicationObject.Open(时间跨度 超时) System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan 超时) System.ServiceModel.Channel.CommunicationObject.Open(时间跨度 超时) System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(字符串 标准化虚拟路径) System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(字符串 标准化虚拟路径) System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(字符串 相对虚拟路径) System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandlerRequest() System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest() System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(对象 (州) System.ServiceModel.AspNetPartialTrustHelpers.PartialTrustInvoke(ContextCallback 回调(对象状态) System.ServiceModel.Activation.HostedHttPrequestStatAsyncResult.OnBeginRequestWithFlow(对象 (州) System.Runtime.IOThreadScheduler.ScheduledOrlApped.IOCallback(UInt32 错误代码,UInt32个字节, NativeOverlapped*NativeOverlapped) System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 错误,UInt32字节读取, NativeOverlapped*NativeOverlapped) System.Threading.\u IOCompletionCallback.PerformiCompletionCallback(UInt32 错误代码,UInt32个字节, 本地重叠*pOVERLAP)
嵌套目录可能会混淆IIS-我以前也遇到过这种情况,但不是在WCF上下文中。请尝试将端点地址更改为:
address="http://localhost/MyService"
address="https://localhost/MySslService"
你能试着从控制台应用程序而不是IIS托管应用程序吗?我很确定IIS以某种方式导致了你的问题,但这可能证实了这一点
如果可能的话,我也会尝试通过删除一些配置细节来隔离问题,例如bindingConfiguration和behaviorConfiguration
显然,这些只是我将执行的调试步骤(您可能已经执行过)尝试隔离问题-抱歉,我没有得到完整的答案。好的,我修复了我的问题。问题是我觉得我必须在IIS中创建一个安全文件夹,并将.svc文件放在其中以保证SSL传输。事实证明并非如此,我所要做的只是使用相同的.svc文件并定义2 endpoints:
<endpoint address="http://localhost/Services/MyService.svc/MyService"
name="MyService" binding="wsHttpBinding"
bindingConfiguration="myWsHttpBinding" contract="Namespace.IMyService" />
<endpoint address="https://localhost/Services/MyService.svc/MySecureService"
name="MySslService" binding="basicHttpBinding"
bindingConfiguration="MySslServiceBinding" contract="Namespace.IMyService" />
谢谢。明天我将尝试使用非嵌套结构,尽管它们的定义方式有点复杂,我必须保护一个文件夹,但这是可能的。测试嵌套的文件夹可能会更简单
<endpoint address="http://localhost/Services/MyService.svc/MyService"
name="MyService" binding="wsHttpBinding"
bindingConfiguration="myWsHttpBinding" contract="Namespace.IMyService" />
<endpoint address="https://localhost/Services/MyService.svc/MySecureService"
name="MySslService" binding="basicHttpBinding"
bindingConfiguration="MySslServiceBinding" contract="Namespace.IMyService" />