嗨,客户端CustomMessageInspector,如何从exe文件中让这段代码的工作?
我上运行服务端CustomMessageInspector,现在我需要在同一客户端支持。然而,在客户端中是不是以同样的方式实现的。我发现这个代码:
https://gist.github.com/1076635
但我有一个很难得到这个从WinForm的项目内运行,我真的不得不把这个类库来得到它的工作?
BestRegards
编辑1:
这是我服务的instanciation怎么看起来像在客户端。
ClientService clientService = new ClientService();
InstanceContext context = new InstanceContext(clientService);
DuplexChannelFactory<MyApp.ServiceContracts.IMyAppClientService> factory = new DuplexChannelFactory<MyApp.ServiceContracts.IMyAppClientService>(context, connectionName);
factory.Credentials.UserName.UserName = anvandarNamn;
factory.Credentials.UserName.Password = password;
return factory.CreateChannel();
这是我当前的行为标签看起来像在的app.config:
<behaviors>
<endpointBehaviors>
<behavior name="BasicBehavior">
<CustomMessageInspector/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
你不应该需要把它放在一个类库它的功能有关您遇到的问题/错误的一些信息可能会有所帮助。 – luksan 2012-03-04 05:32:49