Reputation: 10226
How can i access MVC views in Localhost ?. I have deployed my MVC 2 application on IIS 7 using VS 2010 my url address is localhost/MyApp but i cannot access the views .
I have tried localhost/MyApp/Views/User/logon
but i get 404.0 error
My web config is as follows
<appSettings>
<add key="autoFormsAuthentication" value="false" />
<add key="enableSimpleMembership" value="false"/>
</appSettings>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Routing Code
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
I tried,
1 )To test I added default.aspx page in my root folder and it works fine
2) I ran aspnet_regiis -i
Upvotes: 0
Views: 375
Reputation: 100527
You should be able to get content from either
"MyApp/Home/Index"
or maybe "MyApp/User/Logon"
if you have UserController
with an action called Logon
."MyApp/default.aspx"
, "MyApp/image/image1.png"
or maybe even views "MyApp/Views/User/Logon.aspx"
(I'm not sure about last one, default config may blocks direct rendering of files from Views folder). Other urls (like you tried) should correctly return 404
: there is no route to Views
and no physical file without extension (unless you put one there).
Upvotes: 1