WCF错误:手动解决这一出厂时已启用,所以发出的所有邮件必须预先处理 [英] WCF Error : Manual addressing is enabled on this factory, so all messages sent must be pre-addressed
问题描述
首先,我要感谢那些谁帮我这个WCF的连接,因为这是相当新的给我。
First off, I'd like to thank those who have helped me out with this WCF connectivity, as it's fairly new to me.
我有一个主办我创建一个自定义的工厂,因此,这将有多个主机头工作WCF服务:
I've got a hosted WCF service that I created a custom factory for, so that this would work with multiple host headers:
/// <summary>
/// Required for hosting where multiple host headers are present
/// </summary>
public class MultipleHostServiceFactory : ServiceHostFactory
{
protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
{
List<Uri> addresses = new List<Uri>();
addresses.Add(baseAddresses[0]);
return base.CreateServiceHost(serviceType, addresses.ToArray());
}
}
我敢肯定,我的配置文件现在右,客户端和服务器上(可这里http://stackoverflow.com/questions/1794247/wcf-consumer-website-returning-the-address-property-on-channelfactory-endpoint-wa )看到。
我得到的错误似乎与工厂:
The error I'm getting appears to be related to the factory:
手册寻址是这家工厂启用,因此发出的所有邮件必须预先。可编址
Manual addressing is enabled on this factory, so all messages sent must be pre-addressed.
Line 113:
Line 114: public string GetData(int value) {
Line 115: return base.Channel.GetData(value);
Line 116: }
Line 117:
在线路115出现的错误
The error occurs at line 115.
感谢。
推荐答案
我经历过这种错误和问题通过加入WebHttpBehavior(线以下2)解决:; IService>
I experienced this error and the problem was resolved by adding the WebHttpBehavior (line 2 below):
var factory = new ChannelFactory<IService>(new WebHttpBinding(), uri);
factory.Endpoint.Behaviors.Add(new WebHttpBehavior());
var proxy = factory.CreateChannel();
这篇关于WCF错误:手动解决这一出厂时已启用,所以发出的所有邮件必须预先处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!