English 中文(简体)
WCF 采用Factory。 建立有网站的网页 Httpact
原标题:WCF using ChannelFactory.CreateChannel with webHttp behavior

我正在尝试利用频道Factory创建客户代理人,从而获得一个简单的基于学习技术的服务。 我想没有一个组合文件,因此,我试图在法典中这样做,我认为,除行为外,我别无他用。 任何人都能够告诉我,我怎么能够把这场冲突带入核心法典:

  <behaviors>
   <endpointBehaviors>
    <behavior name="InitBehavior">
     <webHttp />
    </behavior>
   </endpointBehaviors>
  </behaviors>

在这里,我已经删除了一套编号。

var endpoint = new EndpointAddress(urlCommServer);
var binding = new WebHttpBinding();
return ChannelFactory<IInitialization>.CreateChannel(binding, endpoint);
最佳回答

引证。 你们需要把行为添加到海峡法里。

var factory = new ChannelFactory<IInitialization>(binding, endpoint);
var behavior = new WebHttpBehavior();
factory.Endpoint.Behaviors.Add(behavior);
var channel = factory.CreateChannel();

source

问题回答

暂无回答




相关问题
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 ...

热门标签