私は自分のマシンで WCF Web サービスを作成しています。これは、このボックスでこのタイプの最初のサービスです。
多くの SOA SSL サービスを実行しているボックスで実行される .NET 2.0 エンタープライズ アプリが既にあります。
コンピューター用の SSL x509 証明書を作成した内部 SSL サーバー機関があります。テストに使用される同じ認証局によって作成されたクライアント証明書も多数あります。これらの証明書はすべて、現在のアプリで動作します。
プレーン XML メッセージを受け入れる WCF SSL Web サービスを作成しています。今のところ、各要求に対して存在するすべての HTTPHeader を吐き出します。
設定に問題があります。SSLなしで検索できます。
WCF サービス (https) を使用すると、オブジェクトがダウンロードおよび作成され、app.config が正常に変更され、サーバー証明書についてもプロンプトが表示されます。しかし、その WCF サービスにメッセージを送信するとエラーになります。
私のマシンのサービスの URL:
https://8KZVJS1/HeaderIntercept/HeaderIntercept.svc
メッセージを送信しようとすると、エラーが発生し始めます。
HTTP 要求は、クライアント認証スキーム「匿名」では禁止されていました。
app.config を変更しようとしましたが、次のようになりました。
指定された URI スキーム「https」は無効です。「http」が必要です。パラメータ名:経由
更新: いくつかの編集を行っ
たところ、メッセージを受け入れることができるエンドポイントがリッスンしていませんでした。https://8kzvjs1/headerintercept/HeaderIntercept.svc
これは、多くの場合、アドレスまたは SOAP アクションが正しくないことが原因です。詳細については、InnerException (存在する場合) を参照してください。
単純な .NET クライアントを介してこれを機能させ、それをプッシュして、Apache リバース プロキシを使用して未加工の SOAP メッセージをクライアントに渡す必要があります。
何かご意見は?
Windows 7 - 64 ビット。
IIS
SSL - 必須ではありませんが、受け入れられます
匿名アクセス - 有効。
構成エディター - system.webServer/security/access SSL、SSLNegotiateCert、SSL128 をチェック済み
WCF Web サービス web.config
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsHttpEndpointBinding">
<security>
<message clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="HeaderIntercept">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsHttpEndpointBinding" contract="WCFServiceCertificate.IService1" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<serviceCredentials>
<clientCertificate>
<authentication certificateValidationMode="PeerTrust"/>
</clientCertificate>
<serviceCertificate findValue="8KZVJS1" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
クライアント app.config
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsHttpEndpointBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="52428800" maxReceivedMessageSize="65536000" >
<security mode="Transport">
<transport clientCredentialType="Certificate" proxyCredentialType="None" realm=""/>
<message clientCredentialType="Certificate" algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://8KZVJS1/HeaderIntercept/HeaderIntercept.svc"
binding="wsHttpBinding" bindingConfiguration="wsHttpEndpointBinding"
contract="HeaderIntercept.IHeaderIntercept" name="wsHttpEndpointBinding">
<identity>
<dns value="8KZVJS1"/>
</identity>
</endpoint>
</client>
</system.serviceModel>
IHeaderIntercept.cs
[ServiceContract]
public interface IHeaderIntercept
{
[OperationContract]
XElement MCCI_IN200100BC(XElement xml);
}
HeaderIntercept.svc
namespace WCF_Header_Intercept
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
// NOTE: In order to launch WCF Test Client for testing this service, please select Service1.svc or Service1.svc.cs at the Solution Explorer and start debugging.
public class HeaderIntercept : IHeaderIntercept
{
public XElement MCCI_IN200100BC(XElement xml)
{
StringBuilder sb = new StringBuilder();
WebHeaderCollection headers = WebOperationContext.Current.IncomingRequest.Headers;
foreach (string key in headers.Keys) {
sb.AppendLine("header " + key + "=" + headers[key]);
}
OperationContext.Current.IncomingMessageHeaders.AsParallel().ForAll(h => sb.AppendFormat("Name={0}, IsReferenceParameter={1}, MustUnderstand={2}, Namespace={3}, Relay={4}, Actor={5}.{6}", h.Name, h.IsReferenceParameter, h.MustUnderstand, h.Namespace, h.Relay, h.Actor, Environment.NewLine));
System.Diagnostics.Debug.Write(sb.ToString());
return XElement.Parse("<data>" + sb.ToString() + "</data>");
}
}
}