【发布时间】:2011-06-30 00:19:23
【问题描述】:
我正在构建一个 ASP.NET MVC 应用程序,并尝试将其部署在支持 ASP.NET 的免费主机 (0000free) 上。我尝试了几件事,但都没有奏效(即,当我浏览我的网站时,我只看到目录结构):
- 发布到本地文件夹,然后通过 ftp 将发布的文件复制到我的主机(在 public_html 目录中)。
- 通过 ftp 发布到根文件夹:ftp.mywebsite.com
- 通过 ftp 发布到 public_html 文件夹:ftp.mywebsite.com/public_html
通常我只会将 html 文件放在 public_html 文件夹中,但我感觉 MVC 应用程序的部署过程略有不同。我是否必须修改Web.config 或其他文件管理器?通常如何部署 MVC 应用程序(在免费主机上)?
更新:
了解到主机使用 Mono 并支持 .NET 4.0,但我仍然无法部署。
我有 Visual Studio 2010,我使用了它的发布功能(即右键单击项目名称并单击发布),我尝试了几件事:
- 发布方式:FTP到根文件夹。
- 发布方式:FTP到publich_html文件夹。
- 发布方法:文件系统到根文件夹。
- 发布方法:文件系统到publich_html文件夹。
- 发布方法:文件系统到我电脑上的本地目录,然后FTP到root,还尝试了public_html文件夹。
- 我进入 cPanel(控制面板)尝试查看是否必须为我的网站添加/启用 ASP.NET,但我没有看到任何内容。
- 我无法浏览到 Index.aspx,也无法从 index.html 重定向到它(正如 host forum 上的其他帖子所建议的那样),现在我有一个从 index.html 到 Index.aspx 的链接,但是它也不起作用(请参阅http://www.mydevarmy.com)
- 我也尝试将 Index.aspx 重命名为 Default.aspx,但这也不起作用。
楼主论坛的搜索功能有点弱,所以我用google搜索了他们的论坛:http://www.google.com/search?q=publish+asp.net+site%3A0000free.com%2Fforum%2F&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
我一直在阅读Pro ASP.NET MVC Framework,他们有一章关于出版,但它没有提供任何关于出版地点的具体信息,这就是他们所说的(在我的情况下它不是很有帮助):
我应该把我的应用程序放在哪里?
您可以将应用程序部署到任何 服务器上的文件夹。当 IIS 首先 安装,它会自动创建一个 一个名为 Default 的网站的文件夹 网站位于 c:\Inetpub\wwwroot\,但 你不应该觉得有任何义务 把你的应用程序文件放在那里。它的 在主机上托管应用程序很常见 不同的物理驱动器 操作系统(例如,在 e:\websites\example.com)。它的 完全取决于您,并且可能是 受诸如您如何 计划备份服务器。
这是我在尝试查看我的 Index.aspx 页面时遇到的错误:
Unrecognized attribute 'targetFramework'. (/home/devarmy/public_html/Web.config line 1)
Description: HTTP 500. Error processing request.
Stack Trace:
System.Configuration.ConfigurationErrorsException: Unrecognized attribute 'targetFramework'. (/home/devarmy/public_html/Web.config line 1)
at System.Configuration.ConfigurationElement.DeserializeElement (System.Xml.XmlReader reader, Boolean serializeCollectionKey) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationSection.DoDeserializeSection (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationSection.DeserializeSection (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
at System.Configuration.Configuration.GetSectionInstance (System.Configuration.SectionInfo config, Boolean createDefaultInstance) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationSectionCollection.get_Item (System.String name) [0x00000] in <filename unknown>:0
at System.Configuration.Configuration.GetSection (System.String path) [0x00000] in <filename unknown>:0
at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName, System.String path, System.Web.HttpContext context) [0x00000] in <filename unknown>:0
at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName, System.String path) [0x00000] in <filename unknown>:0
at System.Web.Configuration.WebConfigurationManager.GetWebApplicationSection (System.String sectionName) [0x00000] in <filename unknown>:0
at System.Web.Compilation.BuildManager.get_CompilationConfig () [0x00000] in <filename unknown>:0
at System.Web.Compilation.BuildManager.Build (System.Web.VirtualPath vp) [0x00000] in <filename unknown>:0
at System.Web.Compilation.BuildManager.GetCompiledType (System.Web.VirtualPath virtualPath) [0x00000] in <filename unknown>:0
at System.Web.Compilation.BuildManager.GetCompiledType (System.String virtualPath) [0x00000] in <filename unknown>:0
at System.Web.HttpApplicationFactory.InitType (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
【问题讨论】:
-
不应该在 serverfault.com 上问这种问题吗?他们是面向管理员的,而不是编程的......
-
@Robert 我用谷歌搜索了他们的论坛 (
publish asp.net site:0000free.com/forum/),我发现他们正在使用 Mono(不确定这意味着什么)。另一个人也看到了目录树,但被 adding an index.php redirect script 修复了,而且似乎 ASP.NET 项目必须为单声道编译......这有点令人困惑。 -
@Mono 是 .net 的 Linux 版本。我认为将您的 Asp.net MVC 应用程序部署到此主机不会那么容易。你认为他们实际上并不支持 Asp.net。他们只支持 Mono,这是 Asp.net 的 Linux 帖子。很抱歉告诉你这个。
标签: asp.net-mvc publish publishing