2013-03-11 4 views
17

현재 WCF 비누 서비스가 호스팅 된 콘솔 앱인 C# 프로젝트를 진행 중입니다.모노로 자체 호스팅 WCF 서비스

다음은 호스트를 여는 데 사용하는 코드입니다.

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에서 완벽하게 잘 작동하지만 난 얻을 때 리눅스에서 나는 다음과 같은 메시지가 그것을 얻을로 이동 : 나는 어디에서이 문제를 조사 시작하는 아무 생각이

XmlSchema error: Named item http://schemas.microsoft.com/2003/10/Serialization/:anyType was already contained in the schema object table. Consider setting MONO_STRICT_MS_COMPLIANT to 'yes' to mimic MS implementation. Related schema item SourceUri: , Line 3, Position 3.

합니다. 당신이

업데이트를 제공 할 수있는 모든 도움을

감사 : 를 롭 그 굿윈의 제안에 따라 경찰은, 내가 서비스에 액세스 할 수 일한 것처럼 보인다 환경 변수로 MONO_STRICT_MS_COMPLIANT을 추가했습니다. 그러나 지금은 다른 문제가 있습니다. 몇 초마다 몇 가지 요청을 수행하지만 잠시 후 PHP 응용 프로그램이 중단되는 PHP 페이지가 있습니다. 나는 또한 VS2010 WCF 테스트 클라이언트를 통해 서비스에 액세스 할 수 있도록하지 않는 것

This XmlWriter does not accept StartTag at this state Error. at System.Xml.XmlTextWriter.WriteStartElement (System.String prefix, System.String localName, System.String namespaceUri) [0x00000] in :0 at System.Xml.DefaultXmlWriter.WriteStartElement (System.String prefix, System.String localName, System.String ns) [0x00000] in :0 at System.Xml.XmlWriter.WriteStartElement (System.String localName, System.String ns) [0x00000] in :0 at System.ServiceModel.Logger.TraceCore (TraceEventType eventType, Int32 id, Boolean hasRelatedActivity, Guid relatedActivity, System.Object[] data) [0x00000] in :0 at System.ServiceModel.Logger.LogMessage (System.ServiceModel.Diagnostics.MessageLogTraceRecord log) [0x00000] in :0 at System.ServiceModel.Logger.LogMessage (MessageLogSourceKind sourceKind, System.ServiceModel.Channels.Message& msg, Int64 maxMessageSize) [0x00000] in :0 at System.ServiceModel.Channels.Http.HttpRequestContext.InternalReply (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00000] in :0 at System.ServiceModel.Channels.Http.HttpRequestContext.Reply (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00000] in :0 at System.ServiceModel.Dispatcher.MessageProcessingContext.Reply (Boolean useTimeout) [0x00000] in :0 at System.ServiceModel.Dispatcher.OperationInvokerHandler.Reply (System.ServiceModel.Dispatcher.MessageProcessingContext mrc, Boolean useTimeout) [0x00000] in :0 at System.ServiceModel.Dispatcher.OperationInvokerHandler.ProcessRequest (System.ServiceModel.Dispatcher.MessageProcessingContext mrc) [0x00000] in :0 at System.ServiceModel.Dispatcher.BaseRequestProcessorHandler.ProcessRequestChain (System.ServiceModel.Dispatcher.MessageProcessingContext mrc) [0x00000] in :0 at System.ServiceModel.Dispatcher.BaseRequestProcessorHandler.ProcessRequestChain (System.ServiceModel.Dispatcher.MessageProcessingContext mrc) [0x00000] in :0 at System.ServiceModel.Dispatcher.HandlersChain.ProcessRequestChain (System.ServiceModel.Dispatcher.MessageProcessingContext mrc) [0x00000] in :0 at System.ServiceModel.Dispatcher.BaseRequestProcessor.ProcessRequest (System.ServiceModel.Dispatcher.MessageProcessingContext mrc) [0x00000] in :0

Unhandled Exception: System.InvalidOperationException: This XmlWriter does not accept StartTag at this state Error. at System.Xml.XmlTextWriter.WriteStartElement (System.String prefix, System.String localName, System.String namespaceUri) [0x00000] in :0 at System.Xml.DefaultXmlWriter.WriteStartElement (System.String prefix, System.String localName, System.String ns) [0x00000] in :0 at System.Xml.XmlWriter.WriteStartElement (System.String localName, System.String ns) [0x00000] in :0 at System.ServiceModel.Logger.TraceCore (TraceEventType eventType, Int32 id, Boolean hasRelatedActivity, Guid relatedActivity, System.Object[] data) [0x00000] in :0 at System.ServiceModel.Logger.Log (TraceEventType eventType, System.String message, System.Object[] args) [0x00000] in :0 at System.ServiceModel.Logger.Error (System.String message, System.Object[] args) [0x00000] in :0 at System.ServiceModel.Dispatcher.ListenerLoopManager.ProcessErrorWithHandlers (IChannel ch, System.Exception ex, System.ServiceModel.Channels.Message& res) [0x00000] in :0 at System.ServiceModel.Dispatcher.ListenerLoopManager.ProcessRequest (IReplyChannel reply, System.ServiceModel.Channels.RequestContext rc) [0x00000] in :0 at System.ServiceModel.Dispatcher.ListenerLoopManager.TryReceiveRequestDone (IAsyncResult result) [0x00000] in :0

, 그것은 그냥 진행 표시 줄에서 거기 앉아 오류하지 않습니다

나는 다음과 같은 예외가 50 %가 더 이상 얻지 못합니다. 나는 다음과 같은 오류가 아파치 오류 로그에서

:

System.ArgumentException: Should be something like [[hostname:]port:]VPath:realpath at Mono.WebServer.ApplicationServer.AddApplicationsFromCommandLine (System.String applications) [0x00000] in :0 at (wrapper remoting-invoke-with-check) Mono.WebServer.ApplicationServer:AddApplicationsFromCommandLine (string) at Mono.WebServer.Apache.Server.RealMain (System.String[] args, Boolean root, IApplicationHost ext_apphost, Boolean quiet) [0x00000] in :0 at (wrapper remoting-invoke-with-check) Mono.WebServer.Apache.Server:RealMain (string[],bool,Mono.WebServer.IApplicationHost,bool) at Mono.WebServer.Apache.Server.Main (System.String[] args) [0x00000] in :0 [ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentException: Should be something like [[hostname:]port:]VPath:realpath at Mono.WebServer.ApplicationServer.AddApplicationsFromCommandLine (System.String applications) [0x00000] in :0 at (wrapper remoting-invoke-with-check) Mono.WebServer.ApplicationServer:AddApplicationsFromCommandLine (string) at Mono.WebServer.Apache.Server.RealMain (System.String[] args, Boolean root, IApplicationHost ext_apphost, Boolean quiet) [0x00000] in :0 at (wrapper remoting-invoke-with-check) Mono.WebServer.Apache.Server:RealMain (string[],bool,Mono.WebServer.IApplicationHost,bool) at Mono.WebServer.Apache.Server.Main (System.String[] args) [0x00000] in :0

업데이트 2 : 나는 나는 단지 로컬 서비스에 액세스 할 수를 제외하고 지금 가지 작업을 갖고있는 것 같다. 나는. 웹 서비스는 로컬에서 액세스 할 수 있으며 기능은 필요한 작업을 수행하지만 다른 PC에서 액세스 할 수는 없습니다. 나는. 내가 dev에 PC에서 내 dev PC에서 WCF 테스트 클라이언트를 사용하여 모노 서버에서 WCF 서비스에 액세스하려고하고 난 후, 다음과 같은 출력 무엇입니까 : 더 그것을 테스트시 :

Error: Cannot obtain Metadata from http://192.168.1.74:6525/ If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: http://192.168.1.74:6525/ Metadata contains a reference that cannot be resolved: 'http://192.168.1.74:6525/ '.
Content Type application/soap+xml; charset=utf-8 was not supported by service http://192.168.1.74:6525/ . The client and service bindings may be mismatched. The remote server returned an error: (415) Expected content-type 'text/xml; charset=utf-8' but got 'application/soap+xml; charset=utf-8'.HTTP GET Error URI: http://192.168.1.74:6525/ The document was understood, but it could not be processed. - The WSDL document contains links that could not be resolved. - There was an error downloading ' http://localhost:6525/?xsd=xsd0 '. - Unable to connect to the remote server - No connection could be made because the target machine actively refused it 127.0.0.1:6525.

업데이트 3 한 번에 많은 전화가 서비스에 들어올 때처럼 보입니다. 끊임없이 브라우저 페이지에서 새로 고침을 누르면 서비스를 사용하여 충돌하는 것 같습니다.

Mono 내에 System.ServiceModel.Logger.TraceCore에 문제가있는 것 같습니다. 이 문제로 인해 영향을받지 않도록 모노의이 부분을 비활성화하는 방법이 있습니까?

+0

오류 메시지의 조언을 사용하려고 했습니까? MONO_STRICT_MS_COMPLIANT를 yes로 설정 했습니까? 이 블로그 게시물을 확인하십시오 http://erictummers.wordpress.com/2012/01/24/wsdl-in-mono/ – vittore

+0

이 설정 위치를 찾을 수 없었습니다 – Boardy

+2

환경 변수라고 생각합니다 –

답변

1

일부 권한 관련 문제점이 호스팅 서버에서 발생할 수 있으므로 특정 포트에 부여 된 사용 권한을 한 번 확인하십시오. 희망이 유용 할 수 있습니다.

+0

다른 클라이언트가 v2010 내의 WCF 테스트 클라이언트와 같이 연결할 수 있습니다. – Boardy