WSHttpBindingとWindows認証を使用する単純なWCFサービスがあります。このサービスのすべてのメソッド呼び出し時に、サーバーがクライアントの身元を偽装するように強制しようとしています。WCF構成による偽装
私はWCF Service Impersonationに与えられたアドバイスを試みましたが、幸いな結果を得ているわけではありません。私は、WCFサービスのランディングページに移動しようとすると、私はエラーが表示されます。上の
The contract operation 'GetAdvice' requires Windows identity for automatic impersonation. A Windows identity that represents the caller is not provided by binding ('WSHttpBinding',' http://tempuri.org/ ') for contract ('IMagicEightBallService',' http://tempuri.org/ '.
任意のアイデアを教えしようとすると、このエラーの?
解決策全体はftp://petio.org/2011/07/01/MagicEightBall/(またはhttp://petio.org/2011/07/01/MagicEightBall.zipでダウンロード)で閲覧できます。私はローカルIISフォルダにプロジェクトを公開し、http://localhost/MagicEightBall/MagicEightBallService.svcでサービスにアクセスしています。
ありがとうございます!
UPDATE:
私のサービスのWeb.config:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="Petio.MagicEightBall.MagicEightBallService" behaviorConfiguration="MagicEightBallServiceBehavior">
<endpoint name="WSHttpBinding_WindowsSecurity_IMagicEightBallService"
address="http://localhost/MagicEightBall/MagicEightBallService.svc"
binding="wsHttpBinding"
contract="Petio.MagicEightBall.IMagicEightBallService" />
<endpoint address="mex"
binding="mexHttpsBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MagicEightBallServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceAuthorization impersonateCallerForAllOperations="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
マイサービスコード:
public class MagicEightBallService : IMagicEightBallService
{
[OperationBehavior(Impersonation=ImpersonationOption.Required)]
public string GetAdvice()
{
MagicEightBall ball = new MagicEightBall();
return ball.GetAdvice();
}
}
ありがとう、私はちょうど偽装設定オプションの適切な組み合わせが必要でした。 –
今後の予定: を使用する場合は、[OperationBehavior(...)]を使用してすべてのサービスのメソッドを飾る必要があります。 impersonateCallerForAllOperationsが私のためにこれを自動的に行うと誤って想定していたため、これは私のために多くの混乱を招いていました。 –
また、 は私のものを壊していました。私はそれが何であるかを正確に知らないでそこに置いたが、(最後のコメントに加えて)それを削除することは私のアプリを修正した。 –