17

私は現在、WCF SOAPサービスがホストされているコンソールアプリであるC#プロジェクトに取り組んでいます。

以下は、ホストを開くために使用しているコードです。

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エラー:名前付きアイテム http://schemas.microsoft.com/2003/10/Serialization/:anyTypeはすでにスキーマオブジェクトテーブルに含まれていました。MSの実装を模倣するには、MONO_STRICT_MS_COMPLIANTを「yes」に設定することを検討してください。関連するスキーマアイテムSourceUri:、行3、位置3。

この問題の調査をどこから始めればよいのかわかりません。

あなたが提供できるどんな助けにも感謝します

更新: Rob Goodwinsの提案に従って、MONO_STRICT_MS_COMPLIANT機能しているように見える環境変数として、サービスにアクセスできるを追加しました。しかし、今は別の問題が発生しています。数秒ごとに複数のリクエストを実行するPHPページがありますが、1分後にアプリがクラッシュします。

次の例外が発生します。

このXmlWriterは、この状態のエラーでStartTagを受け入れません。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、ブールhasRelatedActivity、Guid relatedActivity、System.Object [] data)[0x00000] in:0 at System.ServiceModel.Logger.LogMessage(System.ServiceModel.Diagnostics.MessageLogTraceRecord log)[0x00000] in:0atSystem.ServiceModel.Logger。 LogMessage(MessageLogSourceKind sourceKind、System.ServiceModel.Channels。

未処理の例外:System.InvalidOperationException:このXmlWriterは、この状態のエラーでStartTagを受け入れません。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、ブール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(システム。

また、VS2010 WCFテストクライアントを介してサービスにアクセスできないようです。エラーは発生せず、プログレスバーが50%になっているだけで、それ以上取得できません。

apacheエラーログに次のエラーが表示されます。

System.ArgumentException:[[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 quick)[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 [エラー]致命的な未処理の例外:System.ArgumentException:Mono.WebServer.ApplicationServerの[[hostname:] port:] VPath:realpathのようなものである必要があります。AddApplicationsFromCommandLine(System.Stringアプリケーション)[0x00000] in:0 at(wrapper remoting-invoke-with-check)Mono.WebServer.ApplicationServer:AddApplicationsFromCommandLine(string)at Mono.WebServer.Apache.Server.RealMain(System.String [] args、ブールルート、IApplicationHost ext_apphost、ブールクワイエット)[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:0IApplicationHost ext_apphost、ブール値quiet)[0x00000] in:0 at(wrapper remoting-invoke-with-check)Mono.WebServer.Apache.Server:RealMain(string []、bool、Mono.WebServer.IApplicationHost、bool)atMono。 WebServer.Apache.Server.Main(System.String [] args)[0x00000] in:0IApplicationHost ext_apphost、ブール値quiet)[0x00000] in:0 at(wrapper remoting-invoke-with-check)Mono.WebServer.Apache.Server:RealMain(string []、bool、Mono.WebServer.IApplicationHost、bool)atMono。 WebServer.Apache.Server.Main(System.String [] args)[0x00000] in:0

アップデート2: ローカルでしかサービスにアクセスできないことを除けば、今はある程度機能しているようです。つまり、Webサービスにはローカルでアクセスでき、関数は本来の機能を果たしますが、別のPCからはアクセスできません。つまり、開発用PCから開発用PCのWCFテストクライアントを使用してMonoサーバー上のWCFサービスにアクセスしようとすると、次の出力が表示されます。

エラー:からメタデータを取得できませんhttp://192.168.1.74:6525/これがアクセス可能なWindows(R)Communication Foundationサービスである場合は、指定されたアドレスでメタデータ発行が有効になっていることを確認してください。メタデータ発行を有効にするためのヘルプについては、http: //go.microsoft.com/fwlink/? LinkId = 65455.WSのMSDNドキュメントを参照して ください-メタデータ交換エラーURI:http://192.168.1.74:6525/ メタデータに解決できない参照が含まれています:'http://192.168.1.74:6525/'。
コンテンツタイプapplication/soap + xml; charset=utf-8はサービスでサポートされていませんでしたhttp://192.168.1.74:6525/。クライアントとサービスのバインディングが一致していない可能性があります。リモートサーバーがエラーを返しました:(415)予期されたcontent-type'text / xml; charset = utf-8'が、' application / soap+xml;を取得しました。charset = utf-8'.HTTP GETエラーURI: http://192.168.1.74:6525/ ドキュメントは理解されましたが、処理できませんでした。-WSDLドキュメントに、解決できなかったリンクが含まれています。-ダウンロード中にエラーが発生しました' http://localhost:6525/?xsd=xsd0'。-リモートサーバーに接続できません-ターゲットマシンが127.0.0.1:6525をアクティブに拒否したため、接続できませんでした。

更新3: さらにテストすると、一度に多くの呼び出しがサービスに加えられたように見えます。サービスを利用しているブラウザページで常に更新を押すと、クラッシュするようです。

System.ServiceModel.Logger.TraceCoreモノ内に何か問題があるようです。モノラルのこの部分を無効にして、この問題の影響を受けないようにする方法はありますか?

4

1 に答える 1

1

ホスティング サーバーのアクセス許可に関連する問題があるようです。特定のポートに与えられたアクセス許可を一度確認してください。これが役立つことを願っています。

于 2013-08-07T23:07:45.647 に答える