【发布时间】:2020-05-13 13:39:42
【问题描述】:
如何调用 URL 地址与基地址完全相同的端点?
string localhost = "http://localhost:1387";
ServiceHost restHost = new ServiceHost(typeof(WebService), new Uri(localhost));
restHost.AddServiceEndpoint(typeof(IWebService), new WebHttpBinding(), "").Behaviors.Add(new RestBehavior());
hosts.Add(restHost);
这是服务,我想用http://localhost:1387 调用它
[WebInvoke(Method = "GET", UriTemplate = "", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
public Stream GetBase()
{
//do action
}
【问题讨论】:
标签: wcf endpoint uritemplate base-address