ウェブサービスの使用は初めてです。リモートコンピュータからのローカル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>
サービスのホスト方法によって異なります。それは自己ホストですか、それともiisですか? – Digvijay
あなたの答えに感謝します!それは自己ホストされています。 – yoann
basicHttpBinding、wsHttpBindingなどを使用しているバインディングは何ですか?いくつかのコードを表示することができれば素晴らしいでしょう - あなたが試したものなど – Digvijay