Click here to Skip to main content
15,898,538 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
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?
Posted

1 solution

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/[^]
 
Share this answer
 
Comments
DannyStaten 22-May-11 14:44pm    
I have already verified several times that my godaddy hosting is running IIS 7.0 and .net 4. I also have checked the bin and I have local copies of all the dlls that their articles mention (IE Microsift.Infrastructure, System.Web.Razor etc etc). I will have to check that one more time because EVERYTHING I can find seems to say that just getting the right dlls in your bin should make everything work.

Before I updated my bin, I would get an error that the dependencies in my web.config couldn't be found. So I wonder if I am missing a namespace in my web.config which is causing the code to not know where to find ViewBag. If that were the case though, it should not work locally... grumble.
DannyStaten 23-May-11 23:22pm    
So it is really strange. I created a new mvc application and made it an exact copy of the one that would not publish. The newly created and spun up project published and ran without a hitch. I had already done the things that you were kind enough to give me as tips, so in my odd world it was something else. That being said, I do appreciate you posting a great answer, and one that is likely to answer 99.9% of the people's needs should they find this thread in their searches for help. Thanks for answering.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900