ASP.NET MVC 2, Windows XP, and IIS 5.1 -
i'm getting headaches trying host mvc 2 on xp's iis! (this on vs 2008, applies vs 2010 well.)
after struggling found way display mvc 2 site iis 5.1, problem there no styling! ideas on how should fix this?
the problem path location. following suggestions link above, if change relative path of css link <link href="../../content/site.css" rel="stylesheet" type="text/css" />
<link href="%3c%=url.content%28" ~="" content="" site.css="" )="" %>="" rel="stylesheet" type="text/css" />
not conversions. when change <link href="<%=url.content(" ~="" content="" site.css="" )="" %>="" rel="stylesheet" type="text/css" />
error "newline in constant."
edit: normal <link href="<%= url.content("~/content/site.css")%>" rel="stylesheet" type="text/css" />
translates <link href="/mvc2.vs2008/content/site.css" rel="stylesheet" type="text/css" />
(where mvc2.vs2008
website root), content/site.css
not found when hosted way.
i'm not sure problem was, value returned url.content()
not recognized iis server (you not retrieve browser). in fact, not supposed need simple links anyway.
steps fix:
- completely reinstall iis 5.1 (uninstall, reboot, delete c:\inetpub folder, install).
- register .net iis (first v2 v4): (error message = "failed access iis metabase")
- in command prompt, go appropriate folder (e.g.
cd c:\windows\microsoft.net\framework\v2.0.50727
) - aspnet_regiis -i
- iisreset
- if step fails error "the service did not respond start or control request in timely fashion. (2147943453, 8007041d)", silently curse frustration, , restart site manually through iis console (start -> programs -> administrative tools -> internet information services). if (rightfully) paranoid, restart pc.
- in command prompt, go appropriate folder (e.g.
- add read access
- download metaacl
- open command prompt
metaacl.vbs "iis://localhost/w3svc"
- view current access (everyone has e)
metaacl.vbs "iis://localhost/w3svc" r
- this fixed it
- add iis virtual directory
- you know, in iis console "default web site."
- reminders on publishing: (you should know already)
- windows authentication (
<authentication mode="windows" />
inweb.config
) requires enable integrated windows authentication in iis directory security. - it helps disable anonymous access. (add
<authorization><deny users="?"/></authorization>
inweb.config
, or uncheck "anonymous access" in iis directory security)
- windows authentication (
- configure iis virtual folder
- iis configuration mappings (right-click virtual folder -> properties -> virtual directory tab -> configuration -> mappings tab)
- add extension ".*", exec path = (copy ".aspx" extension)
- uncheck "check file exists"
- click ok (this goes without saying)
- load website in favourite browser.
now should peachy (it worked on pc). there should no longer need url.content()
, , styling should work.
Comments
Post a Comment