Link to home
Start Free TrialLog in
Avatar of Dave_Angel_Portsmouth
Dave_Angel_Portsmouth

asked on

HTTP service only working as local host

Hi,

I have an ASP.net Framework 4 website which uses a web service with simple HTTP Post & Get.

This works fine locally using localhost, but i cannot connect to it from another machine, which has lead me to belive that this is a permissions issue.

What do i need to do to allow remote machines to use the webservice?

web.config attached.
Web.config

<?xml version="1.0"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>
  <connectionStrings>
    <add name="ApplicationServices"
         connectionString="Data Source=NX13-DB1;Initial Catalog=nplayer;Persist Security Info=True;User ID=nPlayer;Password=nxtera"
         providerName="System.Data.SqlClient" />
  </connectionStrings>

  <system.web>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />

    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login.aspx" timeout="2880" />
    </authentication>

    <membership>
      <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
             enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
             maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
             applicationName="/" />
      </providers>
    </membership>

    <profile>
      <providers>
        <clear/>
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
      </providers>
    </profile>

    <roleManager enabled="false">
      <providers>
        <clear/>
        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
        <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
      </providers>
    </roleManager>
    
    <webServices>
      <protocols>
        <add name="HttpGet"/>
        <add name="HttpPost"/>
      </protocols>
    </webServices>
  </system.web>

  <system.webServer>
     <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>

Open in new window

Avatar of waaromikniet
waaromikniet
Flag of Netherlands image

How are u hosting it?
Avatar of Dave_Angel_Portsmouth
Dave_Angel_Portsmouth

ASKER

On an IIS6 server
(w2k3 \ .net framework 4)
When i go into the hosts file and set localhost to the machines IP address, rather than the loopback address, it doesn't work locally, which leads me to belive that the webservice is only allowing requests from 127.0.0.1.

Where can this be changed?
Are u using IIS?
Yes,  IIS6.
create new website with host header.
Add ip to host file of computer yoy are connecting from and test if this works.

Where are you chaning localhost to ip server? On server itself?
I think localhost is reserved for local. When connecting to other server use ip server of host header.
Masterpass,

I've already looked at that ariticle, please note that the entries exist from line 49 on the web.config file above.

    <webServices>
      <protocols>
        <add name="HttpGet"/>
        <add name="HttpPost"/>
      </protocols>
    </webServices>

I noticed that but just gave the link for your information. One you specify HttpGet & HttpPost in the protocols, you are normally good to go. When you are trying from another computer, is there any specific error messages/ messages that you get ?
On anything other than the localhost, when trying to use the webservice i get a HTTP 500 - Internal Server Error
So you have on server?

website in IIS with host header like test and all ip adresses

On remote computer in host file?

10.x.x.x1  test

In web.config of app consuming webservice?

service url http://test/somefile.asmx
ASKER CERTIFIED SOLUTION
Avatar of masterpass
masterpass
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial