私はWCF休憩Webサービスを持っています。それは正常に動作しています。私は、エンドポイント要素内で利用可能なさまざまな設定値を理解したいと思っています。システムの説明.servicemodel endpoint.address要素rest service
特に、私はアドレス要素の目的を理解しようとしています。値を変更しても、サービスにどのように対処できるかは変わっていないようです。このために、私はVisual Studio 2010とcassiniからサービスを実行しています。ポート番号は888に設定されています。
アドレスが空文字列に設定されています。 http://localhost:888/restDataService.svc/helloは「hello world」を返します。
アドレスが「localhost」に設定されています。 http://localhost:888/restDataService.svc/helloは「hello world」を返します。
アドレスが "pox"に設定されています。 http://localhost:888/restDataService.svc/helloは「hello world」を返します。
アドレス欄にどのような値を設定しても問題ありません。それはURLに影響しません。私が持っている私の唯一の説明は、値が非RESTサービスの方が多いということです。
<system.serviceModel>
<services>
<service behaviorConfiguration="MobileService2.DataServiceBehaviour" name="MobileService2.DataService">
<endpoint address="pox" binding="webHttpBinding" contract="MobileService2.IRestDataService" behaviorConfiguration="webHttp">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="webHttp">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="MobileService2.DataServiceBehaviour" >
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
私も
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class RestDataService : IRestDataService
{
public string Hello()
{
return "hello";
}
}
+1絶対に正しい!ちょうどこれを自分でテストしました。設定が正しい場合、これが発生します。 –