9

I needed to run IISExpress under a specific identity. After going through this post how to run iisexpress app pool under a different identity I changed the processModel's username and password attributes in my \Documents\IISExpress\config\applicationhost.config file.

I would like to verify the change in my web application. Is there a way to verify?

Ultimately, what I'm after is that my security works properly using the PrincipalPermission attribute. I believe the Name property on this attribute matches the user under which IISExpress and my application are running.

Thanks in advance for your help.

Community
  • 1
  • 1
RT.
  • 435
  • 2
  • 9
  • 25

2 Answers2

10

IISExpress runs with current user identity and changing ProcessModel username/password won't help. Only way to run with particular identity is to launch iisexpress.exe with 'runas'.

vikomall
  • 17,379
  • 6
  • 49
  • 39
  • 1
    Since IISExpress gets launched automatically when running the application in VS, is there a way to specify the 'runas?' – RT. Nov 13 '13 at 16:19
  • 1
    just launch VS (devenv.exe) with runas. – vikomall Nov 13 '13 at 18:12
  • Thank you for this response! I posted this question: http://stackoverflow.com/questions/28820491/iis-express-does-not-seem-to-be-picking-up-changes-to-applicationhost-config and have been pulling my hair out trying to figure things out! – Dan Forbes Mar 03 '15 at 20:05
6

I'm probably way too late to help, but have you tried changing your project to run with Local IIS instead of IIS Express?

Here's the way I do it (you could start in Visual Studio, but I find this more straighforward):

  • Launch IIS Manager with admin privilege (important that you have rights to muck with localhost)
  • Add a new Application Pool running with the Identity you need for your database (probably your windows account)
  • Create a new application on iis
    • point it to your project folder
    • assign it to the app pool you just created
  • In Visual Studio open your project's properties (select the project in solution explorer hit Alt-Enter or use context menu). In the Web Section, select Local IIS instead of IIS Express. No need to create virtual directory (you already did).

Now your app can open the database. As an added bonus, your project is always available to run. no need to start it from visual studio.

MikeSullivan
  • 453
  • 5
  • 10