开发者

HTTP 'System.InvalidOperationException' exception

开发者 https://www.devze.com 2022-12-20 14:41 出处:网络
Help. I get the exception below when I try to run my service. I tried running the CMD LINE fixnetsh http add iplisten ipaddress=127.0.0.1:8439 to fix the problem. Problem is I get an IP address succes

Help. I get the exception below when I try to run my service. I tried running the CMD LINE fix netsh http add iplisten ipaddress=127.0.0.1:8439 to fix the problem. Problem is I get an IP address successfully added message but I still get the error below when I run my application. Any idea how I can deal with this please?

An unhandled exception of type 'System.InvalidOperationException' occurred in System.ServiceModel.dll

Additional information: A registration already exists for URI 'http:/开发者_运维问答/127.0.0.1:8439/'.


You've probably got multiple endpoints listening on the same address- could tell for sure if you posted your config (or config code). Do you have an address attribute specified for each endpoint with a unique URI (including mex if applicable)?


I am not using a config here. I am simply creating a channel and listening on an endpoint for requests. However the listener throws the error posted when run.

 CustomBinding custombinding = new CustomBinding();
        custombinding.Elements.Add(new HttpTransportBindingElement());
        BindingParameterCollection paramCollection = new BindingParameterCollection();
        IChannelListener<IReplyChannel> listener = custombinding.BuildChannelListener<IReplyChannel>(new Uri(textBoxURI.Text), paramCollection);
        listener.Open();

        IReplyChannel channel = listener.AcceptChannel();
        //Start listening 
        channel.Open();
        //process received messages
        RequestContext request = channel.ReceiveRequest();
0

精彩评论

暂无评论...
验证码 换一张
取 消