私はサーバー側でこの設定を持つwcfサービスを持っています:
WSHttpBinding wshttp = new WSHttpBinding(SecurityMode.Message);
wshttp.ReceiveTimeout = new TimeSpan(0, 30, 0);
wshttp.MaxBufferPoolSize = 2147483647;
wshttp.MaxReceivedMessageSize = 2147483647;
wshttp.ReaderQuotas.MaxArrayLength = 2147483647;
wshttp.ReaderQuotas.MaxBytesPerRead = 2147483647;
wshttp.ReaderQuotas.MaxDepth = 2147483647;
wshttp.ReaderQuotas.MaxNameTableCharCount = 2147483647;
wshttp.ReaderQuotas.MaxStringContentLength = 2147483647;
wshttp.Security.Message.AlgorithmSuite =
System.ServiceModel.Security.SecurityAlgorithmSuite.Basic256Sha256Rsa15;
wshttp.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
CustomBinding cb = new CustomBinding(wshttp);
var clockSkew = new TimeSpan(2, 0, 0);
SymmetricSecurityBindingElement security =
cb.Elements.Find<SymmetricSecurityBindingElement>();
security.LocalClientSettings.MaxClockSkew = clockSkew;
security.LocalServiceSettings.MaxClockSkew = clockSkew;
// Get the
// System.ServiceModel.Security.Tokens
// .SecureConversationSecurityTokenParameters
SecureConversationSecurityTokenParameters secureTokenParams =
(SecureConversationSecurityTokenParameters)
security.ProtectionTokenParameters;
// From the collection, get the bootstrap element.
SecurityBindingElement bootstrap =
secureTokenParams.BootstrapSecurityBindingElement;
// Set the MaxClockSkew on the bootstrap element.
bootstrap.LocalClientSettings.MaxClockSkew = clockSkew;
bootstrap.LocalServiceSettings.MaxClockSkew = clockSkew;
EndpointAddress ea =
new EndpointAddress(
new Uri("http://localhost:80/MyService"),
System.ServiceModel.EndpointIdentity.CreateDnsIdentity(
"MyService Certeficate"));
isarService.AddServiceEndpoint(
typeof(ServiceLayer.IService),
cb,
new Uri("http://localhost:80/MyService")).Address = ea;
isarService.Open();
構成の半分は、次のようなアプリファイルにあります。
<system.serviceModel>
<bindings />
<client />
<services>
<service behaviorConfiguration="ServiceBehavior" name="SL.Service">
<endpoint address="mex" binding="
mexHttpBinding"
bindingConfiguration=""
name="MexHttpEndPoint" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:80/MyService" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceThrottling maxConcurrentCalls="100"
maxConcurrentInstances="100" />
<serviceCredentials>
<clientCertificate>
<authentication customCertificateValidatorType=""
certificateValidationMode="ChainTrust" />
</clientCertificate>
<serviceCertificate findValue="MyService Certeficate"
storeLocation="CurrentUser"
storeName="Root" x509FindType="FindByIssuerName" />
<userNameAuthentication
userNamePasswordValidationMode="Custom"
customUserNamePasswordValidatorType="ServiceLayer.CUAPValidator,ServiceLayer" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
私はクライアントエラーをログに記録し、多くのクライアントで app.application の動作を修正するためにログファイルを私に送信しますが、一部のクライアントにはこのエラーがあります:
System.ServiceModel.ProtocolException -> ネットワークから受信した XML に問題があります。詳細については、内部例外を参照してください。
System.Xml.XmlException -> ルート レベルのデータが無効です。行 1、位置 1。
99 クライアントがいつこの設定でうまく動作するのか、そのうちの 3 つに問題があるのかわかりません!
質問 :
この問題を最も簡単な方法で修正するのを手伝ってください。
情報 :
私は自分のサービスを Windows サービスでホストしています。
編集1:
クライアント側の svc log で正確なエラーをログに記録します。それから私はエラーを読みました、そしてエラーはそれでした。サーバー側では、ログにエラーが表示されません。正確な違いはわかりませんが、違いはインターネット接続のようです。つまり、プロキシサーバーまたはvpnなどです。
編集2:
これは.netバージョンで起こりますか?? バージョン4にはいくつかの更新があるためです。
編集3:
このエラーは、他のおそらくヘルプと同じです
応答メッセージのコンテンツ タイプ text/html がバインディングのコンテンツ タイプ (application/soap+xml; charset=utf-8) と一致しません。カスタム エンコーダーを使用する場合は、IsContentTypeSupported メソッドが適切に実装されていることを確認してください。応答の最初の 1024 バイトは次のとおりです。フォントサイズ: 10pt; 色: #005a80; FONT-FAMILY: tahoma } A:hover { FONT-WEIGHT: bold; フォントサイズ: 10pt; 色: #0d3372; FONT-FAMILY: tahoma } TD { FONT-SIZE: 8pt; FONT-FAMILY: tahoma } TD.titleBorder { BORDER-RIGHT: #955319 1px solid; BORDER-TOP: #955319 1px ソリッド; PADDING-LEFT: 8px; フォントウェイト: 太字; フォントサイズ: 12pt; VERTICAL-ALIGN: 中間。BORDER-LEFT: #955319 0px ソリッド; 色: #955319; BORDER-BOTTOM: #955319 1px ソリッド; FONT-FAMILY: タホマ; 高さ: 35px; 背景色: #d2b87a; TEXT-ALIGN: 左 } TD. titleBorder_x { BORDER-RIGHT: #955319 0px solid; BORDER-TOP: #955319 1px ソリッド; PADDING-LEFT: 8px; フォントウェイト: 太字; フォントサイズ: 12pt; VERTICAL-ALIGN: 中間。BORDER-LEFT: #955319 1px ソリッド; 色: #978c79; BORDER-BOTTOM: #955319 1px ソリッド; FONT-FAMILY: タホマ; 高さ: 35px; バックグラ」。
AND 内部エラー:
リモート サーバーがエラーを返しました: (500) 内部サーバー エラー。