开发者

ASP.NET MVC subdomain shows folder name

I'm using godaddy shared hosting, with IIS7, Integrated mode, and published up a bog standard MVC2 app to dev.lazygekko.com created with Visual Web Developer 2010.

It all works, however when any of the links are clicked, they point to dev.lazygekko.com/dev/..., dev being the folder it is pointing at.

Can anyone shed some light on what I may be doing wrong?

Many thanks.

UPDATE

I've now managed to break it completely messing with settings, but any ideas for when I get it working again would be most appreciated...

UPDATE 2

Now back up and running on mvc.lazygekko.com. As you can see, urls have mvc.lazygekko.com/mvc/... But I just wan开发者_如何学运维t the mvc.lazygekko.com.

Thanks

UPDATE 3

The links are straight out of the box:

<%= Html.ActionLink("Home","Index","Home") %>

Although I did change the project to .net 3.5 instead of 4.0, changing the : to a =.


Despite Godaddy being of no use whatsoever, the solution to the problem was apparently sitting under their noses in their community section.

This is the url of the solution:

http://codebeater.com/2010/05/solution-for-asp-net-mvc-routing-issue-on-godaddy-shared-hosting/

And this is what you have to do (works on IIS7 with the url rewriting module installed):

Add

  <rewrite>
    <rules>
      <rule name="Remove Virtual Directory">
        <match url=".*" />
        <action type="Rewrite" url="{R:0}" />
      </rule>
    </rules>
  </rewrite>

to system.Webserver in web.config.

But, and this tripped me up, make sure the double quotes are correct double quotes otherwise IIS will explode.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜