locked
WCF REST Hosted on Window azure not working RRS feed

  • Question

  • Hi,

     

    I've a WCF REST project created using .net framework 4.0. It is successfully hosted on window azure.

    but i am not able to access it. When i used the url in browser, it says me "Connection refused".

    Note : It is working fine in local development fabric.

     

     

    Friday, February 18, 2011 1:08 PM

Answers

  • I'm not a WCF expert, so I may be off on this.

    the binding your service is using appears to be webHttpBinding which by default will try to use port 80. However, your service definition file declares that the only allowed port for your service is 8080.

    The service definition file tells the Windows Azure Controller what ports to configure for inbound traffic and load balancing. Since its been set to port 8080, I believe any requests to your service are failling because its looking for the service on port 80 which hasn't been configured as available.

    • Proposed as answer by Mog Liang Thursday, February 24, 2011 9:17 AM
    • Marked as answer by Mog Liang Friday, February 25, 2011 1:38 AM
    Tuesday, February 22, 2011 2:46 PM

All replies

  • Did you declare the endpoint in the solution definition? Without that information, Azure won't configure the proper routing to allow folks to actually connect to service.
    Friday, February 18, 2011 6:33 PM
  • Hi softSan,

    Did you resolved the problem? Could you share the code with us so we could help to locate the issue. You may also use Remote Desktop to connect to the cloud machine and check your service.

    Thanks,

     


    Mog Liang
    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework
    Monday, February 21, 2011 1:35 AM
  • hi,

     

    As i am new to window azure please let me know where and how to declare endpoint in the solution definition.Solution definition means "ServiceDefinition.csdef" file or any other?

    I declare service endpoint behaviour in my web.config as follow:

     

    <system.serviceModel>
      <behaviors>
    
       <endpointBehaviors>
        <behavior name="AuthenticateAspNetAjaxBehavior">
         <webHttp />
        </behavior>
       </endpointBehaviors>
       <serviceBehaviors>
        <behavior name="MyServiceTypeBehaviors">
         <serviceMetadata httpGetEnabled="true" />
        </behavior>
        <behavior name="">
         <serviceMetadata httpGetEnabled="true" />
         <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
       </serviceBehaviors>
      </behaviors>
      <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
      <services>
       <clear />
       
       <service name="ProjectOneInterface.RulesViolation" behaviorConfiguration="MyServiceTypeBehaviors">
        <endpoint address="" behaviorConfiguration="AuthenticateAspNetAjaxBehavior" binding="webHttpBinding" contract="ProjectOneInterface.IRulesViolation"/>
    
        <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
    
    
       </service>
    
       <service behaviorConfiguration="MyServiceTypeBehaviors" name="ProjectOneInterface.Authenticate">
        <clear/>
        <endpoint address="" behaviorConfiguration="AuthenticateAspNetAjaxBehavior" binding="webHttpBinding" contract="ProjectOneInterface.IAuthenticate"/>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
       </service>
       <service behaviorConfiguration="MyServiceTypeBehaviors" name="ProjectOneInterface.SMSBackup">
        <clear/>
        <endpoint address="" behaviorConfiguration="AuthenticateAspNetAjaxBehavior" binding="webHttpBinding" contract="ProjectOneInterface.ISMSBackup"/>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
       </service>
    
       <service name="ProjectOneInterface.CallLogBackup" behaviorConfiguration="MyServiceTypeBehaviors">
        <clear/>
        <endpoint address="" binding="webHttpBinding" behaviorConfiguration="AuthenticateAspNetAjaxBehavior" contract="ProjectOneInterface.ICallLogBackup"/>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
       </service>
    
      </services>
     </system.serviceModel>
    

    Can you please let me know if i am missing something or any other settings  are need to be configure in  ServiceDefinition.csdef file. The structure of my ServiceDefinition.csdef file is as follow :

    <?xml version="1.0" encoding="utf-8"?>
    <ServiceDefinition name="POWR" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
     <WebRole name="ProjectOneInterface">
      <InputEndpoints>
       <InputEndpoint name="HttpIn" protocol="http" port="8080" />
      </InputEndpoints>
      <ConfigurationSettings>
       <Setting name="DiagnosticsConnectionString" />
      </ConfigurationSettings>
     </WebRole>
    </ServiceDefinition>

     

    Monday, February 21, 2011 5:55 AM
  • I'm not a WCF expert, so I may be off on this.

    the binding your service is using appears to be webHttpBinding which by default will try to use port 80. However, your service definition file declares that the only allowed port for your service is 8080.

    The service definition file tells the Windows Azure Controller what ports to configure for inbound traffic and load balancing. Since its been set to port 8080, I believe any requests to your service are failling because its looking for the service on port 80 which hasn't been configured as available.

    • Proposed as answer by Mog Liang Thursday, February 24, 2011 9:17 AM
    • Marked as answer by Mog Liang Friday, February 25, 2011 1:38 AM
    Tuesday, February 22, 2011 2:46 PM
  • HI, We have tried what has been suggested by you. This way we are able to deploy our WCF service and now are not facing "Connection Refused" issue. But, Now when we are trying to browse our service, it gives "Connection Timeout" issue every time and we are not thru with this. Any hope to resolve this issue ??
    Thursday, March 3, 2011 7:22 AM