Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run WCF service on a specific port

Tags:

wcf

I have a .Net 4.0 WCF service running on IIS. I have not specified a port so assume it is running on port 80. I need to install my service on a server where port 80 is already being used and the network guy had asked me to change my service to run on port 443. How do I do this? I'm guessing it can be configured in app.config but I can't find an article that shows me how.

Here is my current app.config:

<system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

like image 639
Steve Chadbourne Avatar asked Dec 15 '11 03:12

Steve Chadbourne


People also ask

How to set port for WCF service?

Just right click on your website that has the WCF Service or if the WCF service applciation is a website in your IIS then select edit bindings, now you can change the http to listen on a different port rather than 80.

What port does WCF use?

The default port is 808.

What is WCF service?

Windows Communication Foundation (WCF) is a framework for building service-oriented applications. Using WCF, you can send data as asynchronous messages from one service endpoint to another. A service endpoint can be part of a continuously available service hosted by IIS, or it can be a service hosted in an application.


1 Answers

I am assuming you are running your services on net.tcp protocols.

1) Edit your bindings (right click Default Web Site select Edit Bindings

enter image description here

2) Server Side

<service name="YouServiceNameSpace.YourService">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="YourBinding" contract="YourContract" />
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" contract="IMetadataExchange" />
</service>

3) Client Side

 <endpoint address="net.tcp://YourHost:443/YourServiceDirecotry/YourService.svc"
    behaviorConfiguration="YourBehavior" binding="netTcpBinding"
    bindingConfiguration="YourTcpBinding" contract="YourContract"
    name="YourContractName" />
like image 150
Surjit Samra Avatar answered Oct 12 '22 12:10

Surjit Samra