简体   繁体   English

部署时,如何使Visual Studio解决方案中的文件夹出现在服务器上(iis7,asp.net mvc4)?

[英]How do I get folders in my Visual Studio solution to appear on my server when I deploy (iis7, asp.net mvc4)?

This seems so rudimentary that I am slightly ashamed to ask, but here I am anyway. 这似乎太基本了,我对此感到有些as愧,但是无论如何我还是在这里。 I have a fairly typical ASP.NET MVC4 solution. 我有一个相当典型的ASP.NET MVC4解决方案。 In there I have a couple of folder in the root directory where I am storing some logs and files. 在那里,我在根目录中有几个文件夹,用于存储一些日志和文件。 In particular I have one page that will list all the .xml files in this directory: 特别是我有一个页面,它将列出此目录中的所有.xml文件:

/ErrorLogs/

Running locally this code works like a charm: 在本地运行此代码就像一个魅力:

 @for (int i = 0; i < 50 && i < dir.GetFiles().Count(); i++)
 {
     <tr>
         <td>
              @dir.GetFiles()[i].LastWriteTime
         </td>
         <td>
              <a href="@Url.Action("DeleteFile", "Home", new { area = "Admin", fileName = @dir.GetFiles()[i].FullName })"><i class="glyphicon glyphicon-remove-circle"></i></a>
         </td>
     </tr>   
 }

Once I deploy the application (Windows Server 2008, IIS 7), I get an error when I navigate to the page. 部署应用程序(Windows Server 2008,IIS 7)后,导航到该页面时出现错误。 Presumably because when I navigate to the folder on the server in inetpub/wwwroot/mysite the folders are not there. 大概是因为当我导航到inetpub / wwwroot / mysite中服务器上的文件夹时,这些文件夹不存在。

In the properties of the folder in VS I only see 'Folder Name' and 'Namespace Provider' in there. 在VS中文件夹的属性中,我仅在其中看到“文件夹名称”和“命名空间提供程序”。

How can I get the folder to copy over when I deploy? 部署时如何获取要复制的文件夹?

假设此文件夹在MVC 项目中,而不是在解决方案中 ,则可以在该文件夹内的项目中添加文件,并将“构建操作”属性设置为“内容”。

暂无
暂无

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

相关问题 在哪里可以学习如何将ASP.NET 4 MVC 2应用程序部署到IIS7? - Where can I learn how to deploy ASP.NET 4 MVC 2 applications to IIS7? 为什么我无法在我的 Visual Studio ASP.NET MVC 解决方案中创建单元测试? - Why am I not able to create unit test in my Visual Studio ASP.NET MVC solution? 我希望我的ASP.NET MVC项目成为服务器上的子站点。 我该怎么做呢? - I want my ASP.NET MVC project to be a subsite on my server. How do I do this? 无法找到该资源。 当我在IIS7上部署ASP.net时 - The resource cannot be found. When I deploy ASP.net on IIS7 我如何在Visual Studio中测试我的SSL所需的ASP.NET MVC网站? - How can I testrun my SSL-Required ASP.NET MVC Website in Visual Studio? 我启动Web应用程序时的ASP.NET MVC4重定向循环 - ASP.NET MVC4 Redirect loop when I start my web application 我可以在.net 4中部署我的ASP.NET MVC 4应用程序吗? - Can I deploy my ASP.NET MVC 4 application in .net 4 如何解决在加载ASP.NET MVC项目时挂起的Visual Studio? - How do I troubleshoot Visual Studio which is hanging when loading ASP.NET MVC project? 在我的新 PC 中使用 Visual Studio 运行 ASP.NET MVC 时,我向它发出的每个请求都会自动将其重定向到 Microsoft 登录 - When running my ASP.NET MVC with Visual Studio in my new PC, every request I make to it automatically redirects it to Microsoft login 当我从另一个用户运行我的 ASP.NET Core MVC 解决方案时,它没有连接到 SQL Server 数据库 - When I run my ASP.NET Core MVC solution from another user it does not connect to the SQL Server database
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM