如何将ASP.NET MVC应用程序发布到免费主机

Kir*_*ril 2 asp.net-mvc publish publishing

我正在构建一个ASP.NET MVC应用程序,我正在尝试将它部署在一个支持ASP.NET的免费主机(0000free)上.我尝试了一些东西,但没有一个工作(即我浏览到我的网站时只看到目录结构):

  1. 发布到本地文件夹,然后通过ftp将发布的文件复制到我的主机(在public_html目录中).
  2. 通过ftp发布到根文件夹:ftp.mywebsite.com
  3. 通过ftp发布到public_html文件夹:ftp.mywebsite.com/public_html

通常我只是将html文件放在public_html文件夹中,但我感觉MVC应用程序的部署过程略有不同.我是否必须修改Web.config或其他文件管理器?如何通常部署MVC应用程序(在免费主机上)?

更新:
我了解到主机使用Mono并支持.NET 4.0,但我仍然无法部署.

我有Visual Studio 2010,我使用它的发布功能(即右键单击项目名称并单击发布),我尝试了几件事:

  1. 发布方法:FTP到根文件夹.
  2. 发布方法:FTP到publich_html文件夹.
  3. 发布方法:文件系统到根文件夹.
  4. 发布方法:文件系统到publich_html文件夹.
  5. 发布方法:文件系统到我的计算机上的本地目录,然后FTP到root,并尝试了public_html文件夹.
  6. 我进入cPanel(控制面板)试图看看是否必须为我的网站添加/启用ASP.NET,但我没有看到任何内容.
  7. 我无法浏览到的Index.aspx我也不能重定向到它的index.html(如从其他职位建议主论坛),现在我有一个链接从index.html的到的Index.aspx,但它不工作要么(见http://www.mydevarmy.com)
  8. 我也尝试将Index.aspx重命名为Default.aspx,但这也不起作用.

主机论坛的搜索实用程序有点弱,所以我使用谷歌搜索他们的论坛:http://www.google.com/search? q =publish + asp.net + site%3A0000free.com%2Fforum% 2F&即= UTF-8&OE = UTF-8&A Q = T&RLS = org.mozilla:EN-US:官方与客户端= firefox的-A

我一直在阅读Pro ASP.NET MVC框架,他们有一章关于发布,但它没有提供有关发布位置的任何具体信息,这就是他们所说的(这在我的案例中并不是很有帮助) ):

我应该把我的申请放在哪里?
您可以将应用程序部署到服务器上的任何文件夹.当IIS首次安装时,它会自动为c:\ Inetpub\wwwroot \创建一个名为Default Web Site的网站的文件夹,但您不应该有任何义务将应用程序文件放在那里.将应用程序托管在与操作系统不同的物理驱动器上是很常见的(例如,在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 
Run Code Online (Sandbox Code Playgroud)

Dar*_*rov 7

如果您的托管服务提供商支持ASP.NET MVC,那么您的部署过程应该与普通ASP.NET应用程序的过程不同.如果不是,您可以尝试进行bin部署.这是MSDN上的另一篇文章.