WCF exception: HTTP cannot be registered, and another application is using TCP port 80

Source: Internet
Author: User

Today, an exception suddenly occurred while debugging the service. The error message is: "HTTP cannot register URL http: // +/temporary_listen_addresses/144ff7cb-10a4-4836-b76a-1a516da4ebda/because another application is using TCP port 80. "

It turns out that the default port 80 has been occupied by other programs. Therefore, an exception is thrown when the default binding endpoint is set for the WCF Service.

The solution is as follows:
Set the bound address in the client code. The Code is as follows:

Instancecontext = new instancecontext (New callbackhandler ());
VaR client = new servicereference2.calculatorclient (instancecontext );
Wsdualhttpbinding Ws = (wsdualhttpbinding) client. endpoint. binding;
WS. clientbaseaddress = new uri (http: // localhost: 30001/); // set the bound address
Console. writeline ("press <enter> to terminate client once the output is displayed .");
Console. writeline ();
Double value1 = 100.00d;
Client. addto (value1 );
Client. Clear ();
Console. Readline ();
Client. Close ();

In addition, you can change the service configuration file of the client and set the bound address. As follows:

<Bindings>
<Wsdualhttpbinding>
<Binding name = "wsdualhttpbinding_icalculator" clsetimeout = "00:01:00" clientbaseaddress = "http: // localhost: 30001 /"
Opentimeout = "00:01:00" receivetimeout = "00:10:00" sendtimeout = "00:01:00"
Bypassproxyonlocal = "false" transactionflow = "false" hostnamecomparisonmode = "strongwildcard"
Maxbufferpoolsize = "524288" maxcompute edmessagesize = "65536"
Messageencoding = "text" textencoding = "UTF-8" usedefaultwebproxy = "true">
<Readerquotas maxdepth = "32" maxstringcontentlength = "8192" maxarraylength = "16384"
Maxbytesperread = "4096" maxnametablecharcount = "16384"/>
<Reliablesession ordered = "true" inactivitytimeout = "00:10:00"/>
<Security mode = "message">
<Message clientcredentialtype = "Windows" negotiateservicecredential = "true"
Algorithmsuite = "default"/>
</Security>
</Binding>
</Wsdualhttpbinding>
</Bindings>

In this way, the service is normal.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.