简体   繁体   English

asp.net c# 与 iis 一起工作,但不与 ZC7C9B5ABC39FC757817E8A49A1E269 合作

[英]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.我正在使用 asp.net 和 c# 我想做的是更改 label 的“颜色”并在单击按钮时运行记事本。 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.当我在视觉工作室(iis express)中测试它时,一切正常,但是当我在 iis 本地运行它时,label 变为红色,但记事本无法运行。 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 .这是因为当您在 IIS Express 中运行应用程序时,整个应用程序在您当前的登录用户下运行。 However, when you migrate the application to IIS, everything executed under application pool identity .但是,当您将应用程序迁移到 IIS 时,所有操作都在应用程序池标识下执行。 By default app pool identity(IIS apppool\appoolname) don't have permission to access C:/Windows/System32/notepad.exe.默认情况下,应用程序池标识(IIS apppool\apppoolname)无权访问 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.如果它有效,那么您可以将身份替换为您自己的用户。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在IIS Express和本地IIS之间进行调试/部署期间,ASP.NET MVC 5 C#URL不同 - ASP.NET MVC 5 C# URL is different during Debugging/Deploying between IIS Express and Local IIS 如何在本地IIS而不是Express中调试ASP.NET 5 Web应用程序 - How to debug an ASP.NET 5 web app in local IIS not Express 在C#ASP.NET应用程序中,任务如何完成以及由谁完成? 是CLR还是IIS表达? - in C# ASP.NET application how task done and who do that ? CLR or IIS express? ASP.NET MVC网站在任何浏览器上都被重定向到本地IIS而不是IIS express - ASP.NET MVC website getting redirected to local IIS instead of IIS express on any browser ASP.NET 内核 Web 3.1 - IIS Express 可以从 localdb 获取数据,但本地 Z5DA5ACF461B4EFB27E6ZEC6 不能 - ASP.NET Core Web 3.1 - IIS Express can fetch data from localdb but local IIS can not IIS Express Asp.Net正在使用该文件 - The file is in use by IIS Express Asp.Net ASP.Net Core Web API 适用于 IIS Express,但在部署到 IIS 时不起作用 - ASP.Net Core Web API works on IIS Express, but not working when deployed to IIS 我在IIS中发布后,在C#ASP.net中执行.Bat文件无法正常工作 - Execute .Bat File in C# ASP.net was not working after I published in IIS 从IIS 7 asp.net C#获取.ini文件 - Get .ini file from IIS 7 asp.net c# OLEDB在asp.net C#IIS上无法读取Excel文件 - OLEDB reading Excel File Not Working on IIS asp.net C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM