[英]Wcf service client doesn't receive stream message
I got strange problem. 我有一个奇怪的问题。 My mvc application doesn't want to receive stream from wcf service.
我的mvc应用程序不想从wcf服务接收流。 By sending stream everything all right!
通过发送流,一切正常! My Client.dll.config file:
我的Client.dll.config文件:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpStream" sendTimeout="00:05:00" messageEncoding="Mtom" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:61174/FileTransferService.svc"
binding="basicHttpBinding" bindingConfiguration="basicHttpStream"
contract="IFileTransferService" name="basicHttpStream" />
</client>
</system.serviceModel>
</configuration>
Client receives this message: "multipart/related; type="application/xop+xml";start=" http://tempuri.org/0 ";boundary="uuid:6fc3add5-b28f-4842-a944-0bb6c79d05c6+id=6";start-info="text/xml"" 客户端收到以下消息:“ multipart / related; type =” application / xop + xml“; start =” http://tempuri.org/0 “; boundary =” uuid:6fc3add5-b28f-4842-a944-0bb6c79d05c6 + id = 6 “;启动信息=” 文本/ xml “的”
I'm using Autofac to create channel: 我正在使用Autofac创建频道:
builder
.Register(c => new ChannelFactory<IFileTransferService>(
new BasicHttpBinding(),
new EndpointAddress("http://localhost:61174/FileTransferService.svc"))).InstancePerLifetimeScope();
builder.Register(c => c.Resolve<ChannelFactory<IFileTransferService>>().CreateChannel())
.As<IFileTransferService>()
.UseWcfSafeRelease();
I've found the decision! 我找到了决定! The problem is in autofac configuration.
问题出在autofac配置中。 I need to set the name of binding config.
我需要设置绑定配置的名称。 The correct solution:
正确的解决方案:
builder.Register(c => new ChannelFactory<IFileTransferService>(
new BasicHttpBinding("basicHttpStream"),
new EndpointAddress("http://localhost:61174/FileTransferService.svc"))).InstancePerLifetimeScope();
builder.Register(c => c.Resolve<ChannelFactory<IFileTransferService>>().CreateChannel())
.As<IFileTransferService>()
.UseWcfSafeRelease();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.