将MVC Razor部署到Godaddy-不存在Viewbag [英] Deploy MVC Razor to Godaddy - Viewbag does not exist

查看:73
本文介绍了将MVC Razor部署到Godaddy-不存在Viewbag的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一周前刚刚创建的解决方案,并且我知道它是Visual Studio的最新版本和MVC的最新版本.它可以在我的本地环境中完美运行,但是当我部署到我的Godaddy主机时,它给了我一个编译错误:Viewbag在这种情况下不存在.

我不得不添加一些对我的项目的引用,并设置一堆来复制本地,然后才能做到这一点.我已经看到了各种各样的东西,关于必须将旧的Visual Studio解决方案升级到MVC3以支持剃须刀.

从我所看到的一切,我已经完成了我需要做的一切.有谁知道它只是Godaddy还不支持Razor吗?

I am working on a solution that I just created a week ago, and I know that it is the latest version of visual studio and the latest version of MVC. It runs perfectly on my local environment, but when I deploy to my godaddy hosting, it gives me a compilation error: Viewbag does not exist in this context.

I had to add a few references to my project and set a bunch to copy local before I would even get that far. I have seen all sorts of stuff about having to upgrade old visual studio solutions to MVC3 to support razor.

From everything I can see, I have done everything I need to on my end. Does anyone know if it''s just Godaddy not supporting Razor yet?

推荐答案

Viewbag是.net 4.0的一部分(它是一个动态对象),所以您必须确保您的帐户在该帐户下运行.我认为Razor View Engine也是.net 4,它当然随MVC3一起提供.

http://help.godaddy.com/article/687 [ http://stackoverflow.com/questions/266205/is-there-a-way-that-i-can-run-a-asp-net-mvc-project-on-godaddy-com- shared-web-hos [ http://community.godaddy.com/groups/web-hosting/forum/topic/mvc-3/ [
The Viewbag is part of .net 4.0 (it is a dynamic object), so you have to make sure your account is running under that. I think the Razor View Engine is .net 4 too, it certainly comes with MVC3.

http://help.godaddy.com/article/687[^]

You might find this thread useful, about deployment (MVC2 under 3.5, but the principles will be the same)
http://stackoverflow.com/questions/266205/is-there-a-way-that-i-can-run-a-asp-net-mvc-project-on-godaddy-com-shared-web-hos[^]

If the above fails (or before riksing the effort!) you might want to ask the support fora there, this looks useful as someone has achived what you want: http://community.godaddy.com/groups/web-hosting/forum/topic/mvc-3/[^]


这篇关于将MVC Razor部署到Godaddy-不存在Viewbag的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆