Wednesday, 4 November 2015

Setup IIS 7 AppPool Identities as SQL Server Logons

C# application can access SQL Database and fetch the data when it runs in IIS Express but cannot connect to SQL Database when runs in IIS. To solve the problem, IIS APPPOOL\AppPoolName must be created and have control over the desired database. To do this:
  • In SQL Server Management Studio, look for the Security folder (the security folder at the same level as the Databases, Server Objects, etc. folders...not the security folder within each individual database)
  • Right click logins and select "New Login"
  • In the Login name field, type IIS APPPOOL\AppPoolName - do not click search
  • Fill whatever other values you like (i.e., authentication type, default database, etc.)
  • Click OK

'AppPoolName' can be fine by:
  • Select the desire website in IIS
  • Click on Basic Bindings
  • Application Pool Name will be the values of the 'Application Pool' 



    No comments:

    SQL: Generate a range of numbers

    SELECT ones.n + 10*tens.n + 100*hundreds.n + 1000*thousands.n FROM       (VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) ones(n),      (VALU...