开发者

ASP.NET Routing not firing when site is published to remote host

开发者 https://www.devze.com 2022-12-19 20:12 出处:网络
I have a website that was originally written in webforms to which I have added MVC functionality. When debugging locally it works fine, however, once published and uploaded to my host the routes do no

I have a website that was originally written in webforms to which I have added MVC functionality. When debugging locally it works fine, however, once published and uploaded to my host the routes do not work and return a 404. I am pretty sure that I have uploaded all the correct files. Would just appear that routing is not working.

Any idea?!

(the site will still serve normal aspx pages fine)

I think the problem may be related to Mixing ASP.NET MVC into ASP.NET WebForms

But I cant see from that thread what the solution was. It looks like it might be something to do with the app_pool mode - but I am running in integrated mode, which is right AFAIK

UPDATE 2

So I think I have routing working. I basically created a new MVC app and went through theweb config file line by line and made sure I have everything I needed. Funnily, none of the tutorials online mention the correct additions you need to make. hey ho.. I have have another issue mind you... When i load my mvc page I am greeted with the message: The SessionStateTempDataProvider requires SessionState to be enabled.

I've added a line 开发者_运维问答to web.config to enable sessions (wasn't aware they were off) and it still doesnt work.

UPDATE I created a new asp.net MVC project and ended up going through web.config line by line and ensuring that everything that related to MVC was included in my hybrid app. Suffice to say that none of the guides mention all the settings that are required (i was using the book professional asp.net mvc 1.0). I then included the global.asax file which is not published and set up a route so that a request for / was not being caught by MVC. I also had to enable sessions in web.config.

And now it works!

Should I mark this question as the answer...not sure on the protocol here :)


I was going through the same thing because I deploy with compiled views. I don't know why but global.asax isn't included in the Release folder that I uploaded. I just figured it was compiled into one of the DLLs. I was getting 404 for everything so I tried uploading global.asax and the site came to life.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号