Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF Impersonation Level Error on System.Data.OracleClient

I currently have a WCF service running in IIS7 and I have have added impersonation on each of the public web methods with the following:

[OperationBehavior(Impersonation = ImpersonationOption.Required)]
public void TestMethod(){}

When ever I call this method from my test client application I get the following error:

Could not load file or assembly 'System.Data.OracleClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=waeraewrar' or one of its dependencies. Either a required impersonation level was not provided, or the provided impersonation level is invalid.

I'm currently using Microsoft Enterprise Library 3.1, and .Net 4.0.

Sample code:

WcfService client = new WcfService();
client.TestMethod();
like image 523
arc1880 Avatar asked Jun 10 '26 13:06

arc1880


1 Answers

Try configuring the client to allow an impersonation level of impersonation. For example:

<system.serviceModel>
    <client>
      <endpoint address="http://xxxxx/Services/xxService.svc"
                binding="wsHttpBinding"
                contract="IServiceContract"
                behaviorConfiguration = "ImpersonationBehavior" />
    </client>
      <behaviors>
          <endpointBehaviors>
               <behavior name="ImpersonationBehavior">
                   <clientCredentials>
                       <windows allowedImpersonationLevel = "Impersonation" />
                   </clientCredentials>
               </behavior>
          <endpointBehaviors>
       </behaviors>
</system.serviceModel>

See this article for more on impersonation and delegation.

like image 79
Andrew Shepherd Avatar answered Jun 13 '26 18:06

Andrew Shepherd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!