Web service / SQL server windows authentication issue in IIS 7

  • Hi all.

    I have a web service that connects to a SQL server 2008 database using windows authentication. It works fine in IIS 6, but fails to connect to the database when installed on IIS 7 (running on Windows Server 2008).

    The web service is set up as a new Application under the default website, and uses the default virtual folder. Anonymouse Authentication is disabled and Windows Authentication is enabled. Application pool is set to ASP.NET v4.0.

    The Windows Authentication Role is installed.

    The service works fine running within the Web Developer Express debugging environment on the same box, but when run from IIS, it passes user 'IIS APPPOOL\ASP.NET v4.0' to the database rather than my domain\userid.

    However, 'System.Web.HttpContext.Current.User.Identity.Name' does return my correct userid from the service.

    The connection string format is...

    Data Source=localhost\\SQLinstance;Trusted_Connection=Yes;Initial Catalog=myDatabase;Integrated Security=True

    If I enable ASP.NET Impersonation rather than Windows Authentication, the service can't find the database at all.

    Can anyone help?

    Many thanks

  • Fixed.

    Just need to set impersonation = true AND start SQL Server Browser.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply