0
我已經創造了一種我試圖消耗不含SVC file.Basically我試圖路線就像我們在asp.net mvc的補充添加到routetable WCF服務1個演示Web應用程序。如何使用路由表中的WCF調用終點?
我採取參考從這裏開始:Reference
代碼:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class PersonService : IPersonService
{
[WebInvoke(UriTemplate = "", Method = "GET")]
public void GetPerson()
{
string k = "a";
}
}
[ServiceContract]
public interface IPersonService
{
[OperationContract]
void GetPerson();
}
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes.Add(new ServiceRoute("foo", new WebServiceHostFactory(), typeof(PersonService)));
}
}
Web.config文件:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"/>
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
當我嘗試調用瀏覽器從我的GetPerson方法然後我得到端點沒有找到。
可有人請幫助我?