Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Mono中的自托管WCF服务_C#_Wcf_Mono_Self Hosting - Fatal编程技术网

C# Mono中的自托管WCF服务

C# Mono中的自托管WCF服务,c#,wcf,mono,self-hosting,C#,Wcf,Mono,Self Hosting,我目前正在从事一个C#项目,这是一个控制台应用程序,其中托管了WCFSOAP服务 下面是我用来打开主机的代码 var baseAddress = new Uri(Configuration.soapServerSettings.soapServerUrl); var host = new ServiceHost(typeof(SoapServer), baseAddress); BasicHttpBinding basicHttpBinding = new BasicHttpBinding();

我目前正在从事一个C#项目,这是一个控制台应用程序,其中托管了WCFSOAP服务

下面是我用来打开主机的代码

var baseAddress = new Uri(Configuration.soapServerSettings.soapServerUrl);
var host = new ServiceHost(typeof(SoapServer), baseAddress);
BasicHttpBinding basicHttpBinding = new BasicHttpBinding();

var meta = new ServiceMetadataBehavior()
{
    HttpGetEnabled = true,
    HttpGetUrl = new Uri("", UriKind.Relative)
};

host.Description.Behaviors.Add(meta);

var debugBehaviour = new ServiceDebugBehavior()
{
    HttpHelpPageEnabled = true,
    HttpHelpPageUrl = new Uri("", UriKind.Relative),
    IncludeExceptionDetailInFaults = true
};

ServiceEndpoint endpnt = host.AddServiceEndpoint(
    typeof(ISoapInterface),
    basicHttpBinding,
    "EmailServer");

host.Description.Behaviors.Remove(typeof(ServiceDebugBehavior));
host.Description.Behaviors.Add(debugBehaviour);
host.Open();
这在Windows上运行得非常好,但在Linux上,当我浏览到它时,会收到以下消息:

XmlSchema错误:命名项 是 已包含在架构对象表中。考虑设置 MONO_STRICT_MS_符合“是”以模拟MS实现。相关的 架构项SourceUri:,第3行,位置3

我不知道从哪里开始调查这个问题

谢谢你能提供的帮助

更新: 根据Rob Goodwins的建议,我添加了
MONO\u STRICT\u MS\u COMPLIANT
作为环境变量,它似乎确实起了作用,我可以访问该服务。然而,我现在遇到了一个不同的问题。我有一个PHP页面,每隔几秒钟会执行几个请求,但一分钟后,我的应用程序崩溃了

我得到以下例外情况:

此XmlWriter在此状态下不接受StartTag错误。在 System.Xml.XmlTextWriter.WriteStarElement(System.String前缀, 中的System.String localName、System.String namespaceUri)[0x00000] :0 at System.Xml.DefaultXmlWriter.WriteStarElement(System.String前缀, System.String localName,System.String ns)[0x00000]in:0 at System.Xml.XmlWriter.writeStarElement(System.String localName,System.String ns)[0x00000]位于:0处 System.ServiceModel.Logger.TraceCore(TraceEventType事件类型,Int32 id,布尔hasRelatedActivity,Guid relatedActivity,System.Object[] 数据)[0x00000]位于:0处 System.ServiceModel.Logger.LogMessage (System.ServiceModel.Diagnostics.MessageLogTraceRecord日志)[0x00000] 输入:0位于System.ServiceModel.Logger.LogMessage (MessageLogSourceKind sourceKind, System.ServiceModel.Channels.Message和msg,Int64 maxMessageSize) [0x00000]英寸:0英寸 System.ServiceModel.Channel.Http.HttpRequestContext.InternalReply (System.ServiceModel.Channels.Message消息,TimeSpan超时)[0x00000] in:0 at System.ServiceModel.Channels.Http.HttpRequestContext.Reply (System.ServiceModel.Channels.Message消息,TimeSpan超时)[0x00000] in:0 at System.ServiceModel.Dispatcher.MessageProcessingContext.Reply(布尔值 使用超时)[0x00000]在:0处 System.ServiceModel.Dispatcher.OperationInvokerHandler.Reply (System.ServiceModel.Dispatcher.MessageProcessingContext mrc,布尔值 使用超时)[0x00000]在:0处 System.ServiceModel.Dispatcher.OperationInvokerHandler.ProcessRequest (System.ServiceModel.Dispatcher.MessageProcessingContext mrc) [0x00000]英寸:0英寸 System.ServiceModel.Dispatcher.BaseRequestProcessorHandler.ProcessRequestChain (System.ServiceModel.Dispatcher.MessageProcessingContext mrc) [0x00000]英寸:0英寸 System.ServiceModel.Dispatcher.BaseRequestProcessorHandler.ProcessRequestChain (System.ServiceModel.Dispatcher.MessageProcessingContext mrc) [0x00000]英寸:0英寸 System.ServiceModel.Dispatcher.HandlersChain.ProcessRequestChain (System.ServiceModel.Dispatcher.MessageProcessingContext mrc) [0x00000]英寸:0英寸 System.ServiceModel.Dispatcher.BaseRequestProcessor.ProcessRequest (System.ServiceModel.Dispatcher.MessageProcessingContext mrc) [0x00000]英寸:0

未处理的异常:System.InvalidOperationException:此XmlWriter 不接受此状态下的StartTag错误。在 System.Xml.XmlTextWriter.WriteStarElement(System.String前缀, 中的System.String localName、System.String namespaceUri)[0x00000] :0 at System.Xml.DefaultXmlWriter.WriteStarElement(System.String前缀, System.String localName,System.String ns)[0x00000]in:0 at System.Xml.XmlWriter.writeStarElement(System.String localName,System.String ns)[0x00000]位于:0处 System.ServiceModel.Logger.TraceCore(TraceEventType事件类型,Int32 id,布尔hasRelatedActivity,Guid relatedActivity,System.Object[] 数据)[0x00000]位于:0处 System.ServiceModel.Logger.Log(TraceEventType事件类型, System.String消息,System.Object[]args)[0x00000]位于:0的System.ServiceModel.Logger.Error(System.String)处 消息,System.Object[]args)[0x00000]位于:0处 System.ServiceModel.Dispatcher.ListenerLoopManager.ProcessErrorWithHandlers (IChannel ch,系统例外示例, System.ServiceModel.Channels.Message&res)[0x00000]位于:0处 System.ServiceModel.Dispatcher.ListenerLoopManager.ProcessRequest (IReplyChannel回复,System.ServiceModel.Channels.RequestContext rc) [0x00000]英寸:0英寸 System.ServiceModel.Dispatcher.ListenerLoopManager.TryReceiveRequestDone (IAsyncResult结果)[0x00000]输入:0

我似乎也无法通过VS2010 WCF测试客户端访问该服务,它不会出错,它只是将进度条设置为50%,不会再进一步

在apache错误日志中,我得到以下错误:

System.ArgumentException:应该类似于 [[hostname:]端口:]VPath:realpath位于 Mono.WebServer.ApplicationServer.AddApplicationsFromCommandLine (System.String应用程序)[0x00000]位于:0处 (带检查的包装器远程处理调用) Mono.WebServer.ApplicationServer:AddApplicationsFromCommandLine (字符串)位于Mono.WebServer.Apache.Server.RealMain(System.string[] args,布尔根,IAApplicationHost ext\u apphost,布尔安静) [0x00000]英寸:0英寸(包装器 远程调用(带复选框)Mono.WebServer.Apache.Server:RealMain (字符串[],bool,Mono.WebServer.iaapplicationhost,bool)位于 中的Mono.WebServer.Apache.Server.Main(System.String[]args)[0x00000] :0[错误]未处理的致命异常: System.ArgumentException:应该类似于 [[hostname:]端口:]VPath:realpath位于 Mono.WebServer.ApplicationServer.AddApplicationsFromCommandLine (System.String应用程序)[0x00000]位于:0处 (带检查的包装器远程处理调用) Mono.WebServer.ApplicationServer:A