简体   繁体   English

MVC应用程序在IIS Express中工作正常,但在本地IIS Web服务器中不工作

[英]MVC Application is working fine in IIS Express but not working in Local IIS web server

I have created a web application to open a file (Whatever like notepad, excel, PDF, etc.) in local directory. 我已经创建了一个Web应用程序来打开本地目录中的文件(无论是记事本,Excel,PDF等)。 File is opening when running it in IIS Express but in IIS local Web server, it's not opening the file. 在IIS Express中运行文件时,文件正在打开,但是在IIS本地Web服务器中,它没有打开文件。

I have the files inside the project in Visual studio. 我在Visual Studio项目中有文件。

System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(@"D:// Path ");

IEnumerable<System.IO.FileInfo> fileList = dir.GetFiles("*.*");
var newestFile =
    (from file in fileList
    //where file.Contains(para)
    orderby file.CreationTime
    where file.FullName.Contains(para)
    select new { file.FullName, file.CreationTime })
    .Last();

Process.Start(newestFile.FullName);

return "";

Try creating a virtual directory with path D:// Path. 尝试使用路径D://路径创建虚拟目录。 Try giving proper permissions to the folder. 尝试赋予该文件夹适当的权限。

Give proper permission to IISUser for the folder in which you are storing the files. 为IISUser授予您在其中存储文件的文件夹的适当权限。

Hope this would help. 希望这会有所帮助。

听起来可能是用户权限,请检查为D://路径设置了哪些安全权限,以及它们与您的有效权限有何不同。

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

相关问题 MVC 5 身份验证在 IIS Express 中工作但不在 IIS 中 - MVC 5 Authentication working in IIS Express but not in IIS MVC 身份验证在 IIS 中不起作用(在 IIS Express 中起作用) - MVC Authentication not working in IIS (works in IIS Express) 文件上载在IIS Express中有效,但在本地IIS上无效 - The file upload working in IIS express but not working on local IIS asp.net c# 与 iis 一起工作,但不与 ZC7C9B5ABC39FC757817E8A49A1E269 合作 - asp.net c# working with iis express but not with iis local DirectorySearcher 在本地工作但不在 IIS 服务器中工作 - DirectorySearcher working in Local but not working in IIS server css在服务器iis 7上运行不正常,就像本地一样 - css not working well in server iis 7 like on local WCF服务在本地而非服务器IIS上运行以实现功能 - WCF service working on local not server IIS for functions ASP.NET web 应用程序 session 本地 IIS Express 上的超时问题 Windows Server 2019? - ASP.NET web application session timeout issue on local IIS Express on Windows Server 2019? 在IIS上找不到UrlMapping并提供404页面,但在本地服务器端口上可以正常工作 - UrlMapping giving 404 Page not found on IIS but working fine on local server port 自定义 TFS Web 应用程序无法在 IIS 上运行 - Custom TFS Web Application not working on IIS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM