简体   繁体   中英

asp.net c# working with iis express but not with iis local

I am working with asp.net and c# What I want to do is to change the label 'color' and run notepad on clicking button. When I am testing this in visual studio (iis express) everything works perfectly but when I run it in iis local the label goes to red but notepad cannot be run. what am I doing wrong?

protected void Button1_Click(object sender, EventArgs e)
{
Label1.BackColor = System.Drawing.Color.Red;
System.Diagnostics.Process.Start("C:/Windows/System32/notepad.exe");
}

That's because when you run application in IIS Express, the whole application run under your current login user . However, when you migrate the application to IIS, everything executed under application pool identity . By default app pool identity(IIS apppool\appoolname) don't have permission to access C:/Windows/System32/notepad.exe. So you can try to set app pool identity to local system . If it works, then you can replace the identity with your own user.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM