2017-04-20 9 views
0

ウェブサービスの使用は初めてです。リモートコンピュータからのローカルWebサービスへのアクセス(ローカルホストとIPアドレス)

Visual Studio 2017(サービスは.svcファイル)を使用してC#でWebサービスを作成しました。

このWebサービスは、リモートマシン上のフォルダに公開されています。

私はリモートマシンに接続すると、私はURLでWebサービスを実行することができます。

http://localhost:1869/ServiceName.svc/

しかし、私は自分のコンピュータからWebサービスを実行しようとしているとき、私は変更してみました'localhost'をIPアドレスに置き換えてurlを送信しますが、動作しません。

ローカルWebサービスにリモートからアクセスできますか?

もしそうでなければ、Webサービスを公開してリモートからアクセスできる最良の方法は何ですか?

ありがとうございました!

-edit-

以下のWeb.configコードを参照してください。

私は、リモートマシン上のWebサーバーを作成し、Visual Studioのソリューションプロジェクト/ Cでコンパイル配置しようとした:、\のinetpub \ wwwrootにあなたの助けを

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <connectionStrings> 
     <add name="RsConnString" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|RestDB.mdf;User Instance=true" providerName="System.Data.SqlClient" /> 
    </connectionStrings> 
    <system.web> 
     <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 
    <system.serviceModel> 
     <services> 
      <service name="RestService.RestServiceImpl" behaviorConfiguration="ServiceBehaviour"> 
       <!-- Service Endpoints --> 
       <!-- Unless fully qualified, address is relative to base address supplied above --> 
       <endpoint address="" binding="webHttpBinding" contract="RestService.IRestServiceImpl" behaviorConfiguration="web"> 
        <!-- 
       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. 
      --> 
       </endpoint> 
      </service> 
     </services> 
     <behaviors> 
      <serviceBehaviors> 
       <behavior name="ServiceBehaviour"> 
        <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
        <serviceMetadata httpGetEnabled="true" /> 
        <!-- 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 --> 
        <serviceDebug includeExceptionDetailInFaults="false" /> 
       </behavior> 
      </serviceBehaviors> 
      <endpointBehaviors> 
       <behavior name="web"> 
        <webHttp /> 
       </behavior> 
      </endpointBehaviors> 
     </behaviors> 
     <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 

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

<system.data> 
    <DbProviderFactories> 
     <remove invariant="MySql.Data.MySqlClient" /> 
     <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" /> 
    </DbProviderFactories> 
    </system.data></configuration> 
+0

サービスのホスト方法によって異なります。それは自己ホストですか、それともiisですか? – Digvijay

+0

あなたの答えに感謝します!それは自己ホストされています。 – yoann

+1

basicHttpBinding、wsHttpBindingなどを使用しているバインディングは何ですか?いくつかのコードを表示することができれば素晴らしいでしょう - あなたが試したものなど – Digvijay

答えて

0

感謝を助けていません!それは、正しくIISおよびWebサイトを構成するに集約link

は、私はそれがそこから次の命令を動作させることができました。

答えるために重要な質問は以下の通りであった。

を使用すると、IISでのサーバーレベルで基本認証を有効にしていますか?

Web管理サービスへのリモート接続を有効にしましたか?

Web管理サービスを開始しましたか?

管理サービスの委任ルールが整っていますか?

ファイアウォールは、TCPポート8172上のサーバーへの着信接続を許可していますか?

関連する問題