ASP.NET MVC 2, Windows XP, and IIS 5.1

I'm having headaches when trying to host MVC 2 on XP IIS! (This applies to VS 2008, but probably applies to VS 2010.)

After much fighting, I finally found a way to display my MVC 2 from IIS 5.1, but the problem is that there is no style! Any ideas on how I should fix this?

The problem is probably the location of the path. Following the recommendations of the link above, if I change the relative path of my CSS link from <link href="../../Content/Site.css" rel="stylesheet" type="text/css" />to <link href="%3C%=Url.Content%28" ~="" content="" site.css="" )="" %>="" rel="stylesheet" type="text/css" />, then it does not do any conversion. When I change it to <link href="<%=Url.Content(" ~="" content="" site.css="" )="" %>="" rel="stylesheet" type="text/css" />, I get the error "New line in constant".

EDIT: Normal <link href="<%= Url.Content("~/Content/Site.css")%>" rel="stylesheet" type="text/css" />translates to <link href="/Mvc2.VS2008/Content/Site.css" rel="stylesheet" type="text/css" />(where Mvc2.VS2008is my site root), but was Content/Site.cssnot found when placing this path.

+3
source share
1 answer

I'm not quite sure what the problem is, but the value returned Url.Content()was not recognized by the IIS server (you could not get it from the browser). In fact, I still don't need this for simple links.

Steps to fix:

  • Reinstall IIS 5.1 completely (uninstall, reboot, delete the C: \ Inetpub folder, install).
  • Register .NET for IIS (first v2, then v4): (Error message = "Failed to access the IIS metabase")
    • (, cd C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727)
    • aspnet_regiis -i
    • IISReset
      • " (2147943453, 8007041d)", IIS ( β†’ β†’ β†’ ). ( ) , .
  • READ
    • MetaAcl
    • Metaacl.vbs "IIS://localhost/W3SVC"
      • ( E)
    • Metaacl.vbs "IIS://localhost/W3SVC" Everyone R
      • .
  • IIS
    • , IIS "- ".
  • : ( )
    • Windows (<authentication mode="Windows" /> in web.config) Windows IIS.
    • . ( <authorization><deny users="?"/></authorization> web.config " " IIS)
  • IIS
    • IIS ( β†’ β†’ " " β†’ " β†’ " ")
    • ". *", exec path = ( .aspx)
    • ", "
    • ( )
  • - .

peachy ( ). Url.Content(), .

+1

Source: https://habr.com/ru/post/1768456/


All Articles