开发者

WCF hosted in IIS, Problem connecting to database with integrated security

I have a WCF service hosted in IIS 5.1 on my development XP machine. The service cannot connect to sql server DB with integrated security=true. The same service works fine when hosted in a console app. I have unchecked Anonymous access and checked the Integrated Windows Authentication in IIS

These are my setting in Web.Config

 <connectionStrings>
 <add name="CADISEntities"  connectionString="metadata=res://*/UDI.CADISEntities.csdl|res://*/UDI.CADISEntities.ssdl|res://*/UDI.CADISEntities.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=DBSQLP404;Initial Catalog=CadisCustom;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
 </connectionStrings>

I have tried changing to Integrated security to SSPI and Trusted Connection =Yes, but no luck. Below is the Config settings.

  <service behaviorConfiguration="CADISBehaviour" name="GlobalInvestors.FIPA.BLL.UDI.CADISSecurities">
    <endpoint binding="basicHttpBinding" bindingConfiguration="CADISBinding"
      contract="GlobalInvestors.FIPA.BLL.UDI.ICADISSecurities" />
  </service>

  <basicHttpBinding>
    <binding name="CADISBinding" closeTimeout="01:30:00" openTimeout="01:30:00"
 开发者_JAVA技巧     receiveTimeout="01:30:00" sendTimeout="01:30:00" maxBufferSize="65536000"
      maxBufferPoolSize="52428800" maxReceivedMessageSize="65536000">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm" />
      </security>
    </binding>
 </basicHttpBinding>

and in client

  <endpoint address="http://ainaost4.amerus.corp.tld/FIPA/BLLHost/CADIS.svc"
    behaviorConfiguration="Behavior" binding="basicHttpBinding"
    bindingConfiguration="BasicHttpBinding_ICADISSecurities" contract="CADISEntities.ICADISSecurities"
    name="BasicHttpBinding_ICADISSecurities">
    <!--<identity>
      <userPrincipalName value="AINAOST4\ASPNET" />
    </identity>-->
  </endpoint>

    <binding name="BasicHttpBinding_ICADISSecurities" closeTimeout="01:30:00"
      openTimeout="01:30:00" receiveTimeout="01:30:00" sendTimeout="01:30:00"
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
      maxBufferSize="655360000" maxBufferPoolSize="655360000" maxReceivedMessageSize="655360000"
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
      useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm"
          realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>

Without setting Impersonation in the code I get "The underlying provider failed on Open" setting Impersonation in the code and I get "Cannot Initialize SSPI"

 [OperationBehavior(Impersonation = ImpersonationOption.Required)]

Tried googling and found that Application pool cannot be set in IIS 5.1.

Any suggestion to fix the issue would be greatly appreciated.


fixed the issue by giving fully qualified sql server name in the connection string

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜