[英]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.