1

Created a WCF service that is hosted in SharePoint and interacts with a SQL database. The site that I'm accessing the service from has kerberos enabled.

When I use the service, it is passing my credentials to SQL. How do I setup the web.config to pass the app pool account credentials to SQL?

<configuration>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<bindings>
  <basicHttpBinding>
    <binding name="customBasicHttpBinding">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Ntlm"/>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="customBasicBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<services>
  <service behaviorConfiguration="customBasicBehavior" name="blah.Services.s1">
    <endpoint address="" binding="basicHttpBinding"
    bindingConfiguration="customBasicHttpBinding"
    contract="blah.Services.Is1">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
  </service>
</services>

1 Answer 1

0

You can try calling SQL using SPSecurity.RunWithElevatedPrivileges. It should execute as app pool account.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.