`standardEndpoint`导致异常`绑定实例已经与listen URI ...`相关联

时间:2012-10-27 11:59:08

标签: asp.net wcf iis-8

我正在使用ASP.Net路由来托管127.0.0.1上的服务(在Win8 + IIS8中),如

WebServiceHostFactory factory = new WebServiceHostFactory();
RouteTable.Routes.Add(new ServiceRoute("Services/ABC/", factory, typeof(ABCService)));

端点的默认行为,如

<standardEndpoints>
    <webHttpEndpoint>
        <standardEndpoint helpEnabled="false"
                          automaticFormatSelectionEnabled="true"
                          faultExceptionEnabled="false"
                          crossDomainScriptAccessEnabled="true"
                          defaultOutgoingResponseFormat="Json"
                          hostNameComparisonMode="StrongWildcard"
                          transferMode="Streamed">
            <security mode="None" />
        </standardEndpoint>
    </webHttpEndpoint>
</standardEndpoints>

这些设置导致错误A binding instance has already been associated to listen URI 'http://<MachineName>/Services/IMAPI/'. If two endpoints want to share the same ListenUri, they must also share the same binding object instance. The two conflicting endpoints were either specified in AddServiceEndpoint() calls, in a config file, or a combination of AddServiceEndpoint() and config.

我不确定这个错误,为什么会发生这种错误,因为我没有在WCF中遇到过,但是这个错误会去除web.config的standardEndpoint配置。

1 个答案:

答案 0 :(得分:0)

您需要将服务URI更改为其他端口。例如端口28900或其他。