title: local web service access from remote computer (localhost vs. ip address)
body: <p>I'm new to using web services.</p>
  
  <p>I created a web service in C# using visual studio 2017 (the service is a .svc file).</p>
  
  <p>This web service is published to a folder on a remote machine.</p>
  
  <p>When I connect to the remote machine, I can run the web service with the url:</p>
  
  <p><a href="http://localhost:1869/ServiceName.svc/" rel="nofollow noreferrer">http://localhost:1869/ServiceName.svc/</a></p>
  
  <p>But when I'm trying to run the web service from my computer, I tried to modify the url by replacing 'localhost' with the ip address but it doesn't work.</p>
  
  <p>Is it possible to access remotely a local web service?</p>
  
  <p>If not, what is the best way to publish the web service so that it can be accessed remotely?</p>
  
  <p>Thanks for your help!</p>
  
  <p>-EDIT-</p>
  
  <p>See Web.config code below.</p>
  
  <p>I tried to create a web server on the remote machine and place the Visual Studio solution project / compile it in C:\inetpub\wwwroot, did not help</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
      &lt;connectionStrings&gt;
          &lt;add name="RsConnString" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|RestDB.mdf;User Instance=true" providerName="System.Data.SqlClient" /&gt;
      &lt;/connectionStrings&gt;
      &lt;system.web&gt;
          &lt;compilation debug="true" targetFramework="4.0" /&gt;
      &lt;/system.web&gt;
      &lt;system.serviceModel&gt;
          &lt;services&gt;
              &lt;service name="RestService.RestServiceImpl" behaviorConfiguration="ServiceBehaviour"&gt;
                  &lt;!-- Service Endpoints --&gt;
                  &lt;!-- Unless fully qualified, address is relative to base address supplied above --&gt;
                  &lt;endpoint address="" binding="webHttpBinding" contract="RestService.IRestServiceImpl" behaviorConfiguration="web"&gt;
                      &lt;!-- 
                Upon deployment, the following identity element should be removed or replaced to reflect the 
                identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
                automatically.
            --&gt;
                  &lt;/endpoint&gt;
              &lt;/service&gt;
          &lt;/services&gt;
          &lt;behaviors&gt;
              &lt;serviceBehaviors&gt;
                  &lt;behavior name="ServiceBehaviour"&gt;
                      &lt;!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --&gt;
                      &lt;serviceMetadata httpGetEnabled="true" /&gt;
                      &lt;!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information --&gt;
                      &lt;serviceDebug includeExceptionDetailInFaults="false" /&gt;
                  &lt;/behavior&gt;
              &lt;/serviceBehaviors&gt;
              &lt;endpointBehaviors&gt;
                  &lt;behavior name="web"&gt;
                      &lt;webHttp /&gt;
                  &lt;/behavior&gt;
              &lt;/endpointBehaviors&gt;
          &lt;/behaviors&gt;
          &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="true" /&gt;
  
      &lt;/system.serviceModel&gt;
      &lt;system.webServer&gt;
          &lt;modules runAllManagedModulesForAllRequests="true" /&gt;
      &lt;/system.webServer&gt;
  
  &lt;system.data&gt;
      &lt;DbProviderFactories&gt;
        &lt;remove invariant="MySql.Data.MySqlClient" /&gt;
        &lt;add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /&gt;
      &lt;/DbProviderFactories&gt;
    &lt;/system.data&gt;&lt;/configuration&gt;
  </code></pre>