English 中文(简体)
WCF 3.5 找到用于服务(服务器一侧)的客户
原标题:WCF 3.5 find the url the client used to get to the service (server side)
  • 时间:2012-05-16 10:50:26
  •  标签:
  • wcf

我正试图找到用于接收服务器(服务器一侧)的客户。 我已尝试如下:

Uri url = OperationContext.Current.Channel.RemoteAddress.Uri;
Uri url = OperationContext.Current.Channel.Local.Uri;
Uri url = OperationContext.Current.EndpointDispatcher.EndpointAddress.Uri;

但这些似乎都没有正确发挥作用。 他们都交还了服务器名称(拥有完全满空的域)。 比如我的服务器。 即使我使用我的服务器/我的服务,它也会获得全名。

At this point I don t have a service and domain available to test going to mywebsite.com/myservice.svc to see if it has the machine name or not.

我想要获得的结果(从服务器上得到):

http://mywebsite.com/myservice.svc

而不是

http://myserver.mydomain. local/myservice.svc

此时此刻似乎发生了这种情况。

问题回答

If you have access to the HttpContext you can use HttpContext.Current.Request.Url.ToString().

应向该客户提供与服务器连接的Uri。





相关问题
WCF DataMember Serializing questions

Ok, so I was part way through the long winded process of creating DTOs for sending my model over the wire and I don t feel like I m going down the right route. My issue is that most of the entities ...

Access WCF service on same server

I have a .NET website with a WCF service. How do I access the current operations context of my service? One possible work around is to just make a call to the service within the app...but that seems ...

WCF binding error

So I got into work early today and got the latest from source control. When I try to launch our ASP.NET application, I get this exception: "The binding at system.serviceModel/bindings/wsHttpBinding ...

The service operation requires a transaction to be flowed

I am facing strange issue with our WCF service. The same code was working fine until recently we added more OperationContracts(Web Methods). We have common 3 tier architecture. DAL (WCF) BLL Web ...

热门标签