wcf restサービスを設定する際に何か愚かなことをしていますか教えてください。 私はWebアプリケーションを作成し、wcfサービスを追加しました。ここでWCF休憩サービス:方法を呼び出すことができません
は私のweb.configファイルは
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="WebApplication1.Service1">
<endpoint address="../Service1" behaviorConfiguration="httpBehavior"
binding="webHttpBinding"
contract="WebApplication1.IService1"/>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="httpBehavior">
<webHttp helpEnabled="true" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
そして、私のサービス・インターフェースである:
[ServiceContract]
public interface IService1
{
[OperationContract]
[WebGet(UriTemplate = "data/{value}", ResponseFormat = WebMessageFormat.Json)]
Person GetData(string value);
}
そして、私のサービスコード:
public class Service1 : IService1
{
public Person GetData(string value)
{
return new Person()
{
Id = Convert.ToInt32(value),
Name = "John Doe"
};
}
}
public class Person
{
public int Id { get; set; }
public string Name { get; set; }
}
私はサービスに閲覧問題がない http://localhost/RoleProviderSite/Service1.svc ただし、データ/ 10 01を追加するとすぐにhttp://localhost/RoleProviderSite/Service1.svc/data/10 「積極的にHTTP」で聴いて何のチャンネルはありませんでした://mymachinename/RoleProviderSite/Service1.svc/data/10" は
私は思ってもみなかったこと "[のWebGet(UriTemplate =" データ/ {値を追加します} "、ResponseFormat = WebMessageFormat.Json)]"このURLにアクセス可能であることを意味しますが、何か不足している可能性があります。私が使用している
: インターネットインフォメーションサービス、バージョン:5.1 とXP OS任意の助けのために非常に多くの
感謝。
My Hero!私はすべてを試してみたと思って、そのトリックをしました。 – blomster