我正在使用一个免费的Web主机(0000free),它支持ASP.NET MVC,但它使用Mono。 这是我第一次部署MVC应用程序,所以我有点困惑,我需要部署它。 我有Visual Studio 2010,我用它的发布function(即右键单击项目名称,然后单击发布),我尝试了几件事情:
主机论坛的search实用程序有点弱,所以我使用谷歌search他们的论坛: 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首次安装时,它会自动为一个名为Default Web Site的网站创build一个文件夹,位于c:\ Inetpub \ wwwroot \,但您不应该有任何义务将您的应用程序文件放在那里。 将应用程序托pipe在与操作系统不同的物理驱动器上(例如,在e:\ websites \ example.com中)是非常常见的。 这完全取决于您,可能会受到诸如计划备份服务器等问题的影响。
这里是我尝试查看我的Index.aspx页面时得到的exception:
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
“无法识别的属性targetFramework”意味着你的构build是针对一个不被服务器支持的框架。 一个例子是,如果服务器只支持<= 3.5,而你的构build目标是.Net 4.0,则会产生这个错误。 所以首先要仔细检查你的.Net版本的目标和服务器支持的版本。
你的应用程序针对什么版本的MVC? 单声道目前只支持ASP.NET 1.1和2.0的大部分,所以如果你的应用程序面向更高的框架将有问题。 另外,Mono还不支持MVC3,所以如果你使用它,你将不得不重新思考。
另外,看看这里移植一个MVC应用程序到Mono。