Answered how to open port windows azure

  • Monday, January 17, 2011 6:05 AM
     
     
    I can't open port 80 on windows azure. I want to use it to webserver. Can you help me? THanks alot.

All Replies

  • Monday, January 17, 2011 6:39 AM
    Answerer
     
     
    If you are trying to run a web server other than IIS,  I believe you need to install it in a worker role.
  • Monday, January 17, 2011 9:44 AM
     
     
    yes, i only use IIS. but when i user my ip to connect my website, it doesn't work.
  • Monday, January 17, 2011 2:03 PM
     
     

    Hi,

    When using a WebRole, you automatically get IIS and a HTTP InputEndpoint listening on port 80. If you have multiple WebRoles an arbitrary portnumber is assigned to the latter WebRole.

    So, long story short,.... In the management portal you can see what ports are used. I can imagine that your WebRole is not listening on port 80 and you could experience that as not being able to connect, since you'd have to append the portnumber to the host address.

    Can you give us a bit more detail or describe what's mentioned in the management portal?

     


    With regards,

    Patriek
    If this reply is of help to you, please don't forget to mark it as an answer.
  • Tuesday, January 18, 2011 4:31 AM
    Moderator
     
     
    And also include your package config files, maybe there are some overrides on the ports that aren't supposed to be there?
  • Saturday, January 22, 2011 1:49 PM
     
     
    how can I open port in windows azure server 2008? examp port 55555, I add in firewall rules but not work, pls help me.
  • Saturday, January 22, 2011 2:31 PM
     
     Answered

    To open a port in an Azure role and make a successfull connection to that port from the outside you need to understand that there is always a firewall/load-balancer in front of your worker role.

    So typically you must declare the port you want to make available from the internet in the "ServiceDefinition.csdef" file to make the firewall/load-balancer ready.

    (this example opens TCP port 123)

    <?xml version="1.0" encoding="utf-8"?>
    <ServiceDefinition name="MyTcpCloud" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
      <WorkerRole name="MyTcpHost">
        <ConfigurationSettings>
          <Setting name="DiagnosticsConnectionString" />
        </ConfigurationSettings>
        <Endpoints>
          <InputEndpoint name="MyEndpoint" protocol="tcp" port="123" />
        </Endpoints>
      </WorkerRole>
    </ServiceDefinition>

     

    Then in your code running in the worker-role you need to create a listener that connects to the load-balancer (which may use a different port number in the communication with the worker role)

    TcpListener listener = new TcpListener(
                    RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["MyEndpoint"].IPEndpoint); 

    For a complete working example that even handles load-balancing, see Maarten Balliauw excellent blog:  http://blog.maartenballiauw.be/post/2010/01/17/Creating-an-external-facing-Azure-Worker-Role-endpoint.aspx

    // Ronny