locked
Not able to access the hosted WCF Service from one machine to another RRS feed

  • Question

  • User-1915511747 posted

    Hi,

    I have hosted .Net 4.0 based WCF Service on machine's IIS 7.0.

    I am able to browse it and also I am able to refer it from my .NET code from the same machine. But when I am trying to access/refer it from some different machine in the same network its giving the following error:

    There was an error downloading 'http://MyMachine:50814/ApplicationDataService.svc'.
    The request failed with HTTP status 503: Service Unavailable.
    Metadata contains a reference that cannot be resolved: 'http://MyMachine:50814/ApplicationDataService.svc'.
    The HTTP service located at http://MyMachine:50814/ApplicationDataService.svc is too busy. 
    The remote server returned an error: (503) Server Unavailable.
    If the service is defined in the current solution, try building the solution and adding the service reference again.

    And alsoI am not able to browse the WSDL from different machine.

    Can anyone please help me on this issue.

    Thanks in advance.

    Regards,

    Afreen

    Sunday, February 19, 2012 11:58 PM

Answers

  • User-742633084 posted

    If you can access the .svc endpoint and ?wsdl page correctly from remote client machine(while the other users cannot), I'd suggest you try putting a simple ASP.NET aspx page in the same application to see if the same access issue also occurs for that user. If the same issue occurs for web page, the problem is not WCF specific, but is related to the remote access of the IIS web directory from remote client. Is there any authentication enabled on IIS or have you checked if anonymous authentication is enabled?

    Also, another thing you can check is if you have enabled "multipleSiteBindingsEnabled" setting. This can help make your IIS hosted WCF service be able to accept requests under various host names(local servername and external DNS names...). This setting is WCF 4.0 specific

    #Supporting Multiple IIS Site Bindings
    http://msdn.microsoft.com/en-us/library/ee358763.aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 22, 2012 11:34 PM

All replies

  • User-425639139 posted

    It looks like port 50814 is not accessible from different machine, try hosting the WCF on Port 80 on IIS and see if it works, also try to ping the Server where WCF is hosted to see if it is responding or not ?

    Monday, February 20, 2012 12:52 AM
  • User-1915511747 posted

    Thanks Ankit for your response.

    Actually the issue is the other machine is able to access this URL: http://MyMachine:50814/ApplicationDataService.svc

    But not able to access http://MyMachine:50814/ApplicationDataService.svc?WSDL


    Its seems that the other machine is not able to access the WSDL.

    Do you have some idea for this.

    Regards,

    Afreen

    Monday, February 20, 2012 1:57 AM
  • User-425639139 posted

    There could be several reason :

    1. A service behavior which enables service metadata
    2. Set the httpGetEnabled=True on that service metadata behavior to allow http browsing to that metadata
    3. A mex endpoint on your service

    So ideally your config should look like with httpGetEnabled="true"

    <system.serviceModel>
        <behaviors>
          <serviceBehaviors>
            <behavior name="MetadataBehavior">
              <serviceMetadata httpGetEnabled="true" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
    
        <services>
          <service behaviorConfiguration="MetadataBehavior" name="YourService">
            <endpoint address="" 
                      binding="basicHttpBinding" 
                      contract="IYourService" />
            <endpoint address="mex" 
                      binding="mexHttpBinding" 
                      contract="IMetadataExchange" />
          </service>
        </services>
      </system.serviceModel>
    

    Let me know if this helps.

    Monday, February 20, 2012 2:23 AM
  • User-1915511747 posted

    Thanks Ankit for your response.

    I had already implemented the above given code in the .config file.

    I hosted the service at port 80 and I am able to browse it with the following URL:

    http://mustafaa1.asiapacific.hpqcorp.net/ApplicationDataService.svc?wsdl

    I have given the permissions to a user, but he is not able to browse the wsdl.

    He is able to ping mustafaa1.asiapacific.hpqcorp.net perfectly.

    I am not able to find any reason for this. Could you please help me to sort the issue.

    Thanks & regards,

    Afreen

    Monday, February 20, 2012 10:58 PM
  • User-425639139 posted

    Then it could only be because of the following reasons:

    • Wrong URL
    • Firewall is blocking port 80
    • Change Binding to basicHttpBinding from WsHttpBinding. of your WCF Service and rebuild.

    Please let me know if this helps, if not then please paste your binding details here for better analysis.

    Tuesday, February 21, 2012 4:51 AM
  • User-742633084 posted

    If you can access the .svc endpoint and ?wsdl page correctly from remote client machine(while the other users cannot), I'd suggest you try putting a simple ASP.NET aspx page in the same application to see if the same access issue also occurs for that user. If the same issue occurs for web page, the problem is not WCF specific, but is related to the remote access of the IIS web directory from remote client. Is there any authentication enabled on IIS or have you checked if anonymous authentication is enabled?

    Also, another thing you can check is if you have enabled "multipleSiteBindingsEnabled" setting. This can help make your IIS hosted WCF service be able to accept requests under various host names(local servername and external DNS names...). This setting is WCF 4.0 specific

    #Supporting Multiple IIS Site Bindings
    http://msdn.microsoft.com/en-us/library/ee358763.aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 22, 2012 11:34 PM
  • User369672091 posted

    You should add the endpoint address in config file of WCF application.This address can be blank in case only if you are hosting your WCF service at localhost.But if you hosting it at some other machine,then it should be something like:

    <system.serviceModel>
    <services>
    <service name="WcfService_SSO.Service1" behaviorConfiguration="WcfService_SSO.Service1Behavior">
    <!-- Service Endpoints -->
    <endpoint address="http://rtspotesting1.dibonchd.com/Service/Service1.svc" binding="wsHttpBinding" contract="WcfService_SSO.IService1">

    All the best!

    This could help me,Hope this help for you

    Smile

    Friday, July 12, 2013 7:58 AM