Может кто-нибудь сказать мне, почему эта служба REST не работает?
namespace WCFRestExample
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
public class HelloWorld : IHelloWorld
{
[WebGet(UriTemplate="/", ResponseFormat=WebMessageFormat.Xml)]
public string GetData()
{
return "HIIII";
}
}
}
namespace WCFRestExample
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
[ServiceContract]
public interface IHelloWorld
{
[OperationContract]
string GetData();
}
}
Это мой web.config:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Я могу просматривать службу .svc и правильно получаю страницу, но при просмотре:
http://localhost:60503/HelloWorld.svc/GetData
Я получаю страницу 404. Кто-нибудь может сказать мне, что происходит и где я могу найти учебники для WCF REST? Это самая простая услуга, которую можно создать, и даже она не работает для меня.
Заранее спасибо:)