WindowsベースのアプリであるクライアントアプリケーションからWebサービスにアクセスしようとすると、次のエラーが発生します
System.ServiceModel.Security.SecurityNegotiationException:リモートエンドポイントとのセキュリティネゴシエーションが失敗したため、セキュリティで保護されたチャネルを開くことができません。これは、チャネルの作成に使用されたEndpointAddressにEndpointIdentityがないか、正しく指定されていないことが原因である可能性があります。EndpointAddressによって指定または暗黙的に指定されたEndpointIdentityがリモートエンドポイントを正しく識別していることを確認してください。---> System.ServiceModel.FaultException:セキュリティトークンのリクエストに無効な要素または不正な形式の要素が含まれています。System.ServiceModel.Security.SecurityUtils.ThrowIfNegotiationFault(メッセージメッセージ、EndpointAddressターゲット)at System.ServiceModel.Security.IssuanceTokenProviderBase`1.ThrowIfFault(メッセージメッセージ、EndpointAddressターゲット)atSystem.ServiceModel.Security.SspiNegotiationTokenProvider。
サーバースタックトレース:System.ServiceModel.Security.IssuanceTokenProviderBase
1.DoNegotiation(TimeSpan timeout) at System.ServiceModel.Security.SspiNegotiationTokenProvider.OnOpen(TimeSpan timeout) at System.ServiceModel.Security.TlsnegoTokenProvider.OnOpen(TimeSpan timeout) at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Security.SecurityUtils.OpenCommunicationObject(ICommunicationObject obj, TimeSpan timeout) at System.ServiceModel.Security.SymmetricSecurityProtocol.OnOpen(TimeSpan timeout) at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Channels.SecurityChannelFactory
1.ClientSecurityChannel1.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.DoOperation(SecuritySessionOperation operation, EndpointAddress target, Uri via, SecurityToken currentToken, TimeSpan timeout) at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.GetTokenCore(TimeSpan timeout) at System.IdentityModel.Selectors.SecurityTokenProvider.GetToken(TimeSpan timeout) at System.ServiceModel.Security.SecuritySessionClientSettings
1.ClientSecuritySessionChannel.OnOpen(TimeSpan timeout)at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpanタイムアウト)at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout、CallOnceManagercascade)
System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)at System.ServiceModel.Channels.ServiceChannel.Call(String action、Boolean oneway、ProxyOperationRuntime operation、Object [] ins、Object [] outs、TimeSpan timeout)atSystem。 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessageメッセージ)でのServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall、ProxyOperationRuntime操作)
私もaspメンバーシッププロバイダーを使用しています...。
私はここ数時間これを機能させようとしていますが、どこにも行きません.....面白いことに、アプリはローカルマシンで動作しますが、リモートマシンからは動作しません
ありがとう
{{
<services>
<service name="AutoWatch.Entity.WcfService.SecurityService" behaviorConfiguration="ServiceBehavior">
<endpoint binding="wsHttpBinding" bindingConfiguration="ServiceBinding" bindingName="ServiceBinding" contract="AutoWatch.Entity.WcfService.ISecurityService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost..." />
</baseAddresses>
</host>
</service>
<service name="servicename" behaviorConfiguration="ServiceBehavior">
<endpoint binding="wsHttpBinding" bindingConfiguration="ServiceBinding" bindingName="ServiceBinding" contract="Service" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost/.../" />
</baseAddresses>
</host>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="ServiceBinding"></binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<!-- Configure role based authorization to use the Role Provider -->
<serviceAuthorization principalPermissionMode="UseAspNetRoles" roleProviderName="SqlRoleProvider" />
<serviceCredentials>
<!-- Configure user name authentication to use the Membership Provider -->
<userNameAuthentication userNamePasswordValidationMode="MembershipProvider" membershipProviderName="SqlMembershipProvider" />
<!-- Configure the service certificate -->
<serviceCertificate storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" findValue="......co.za" />
</serviceCredentials>
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="True" />
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
}