Server error in application '/' This page type is not served

I have a host on which I hosted a webpage with an extension .cshtml. My host is arvixe.com, which provides ASP and .NET hosting, but when I try to load my webpage, I get this error message.

Server error in application "/".

This page type is not served.

Description. The type of page requested is not served because it is explicitly prohibited. The .cshtml extension may be incorrect. Check out the URL below and make sure it is spelled correctly.

Requested URL: /samples/WoT/Default.cshtml

Version Information: Microsoft.NET Framework Version: 4.0.30319; ASP.NET Version: 4.0.30319.276

I read something that I need to write something in the web.config file so that it works like this

<compilation>
  <assemblies>
    <add assembly="System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  </assemblies>
  <buildProviders>
    <add extension=".cshtml" type="System.Web.WebPages.Razor.RazorBuildProvider, System.Web.WebPages.Razor"/>
  </buildProviders>
</compilation>

But I tried everything, inserted it in different lines, nothing worked. What am I missing or doing wrong?

+5
source share
3 answers

I believe that you are not using the MVC function and are trying to load only the external appearance of the razor or user folders.

Then you need to enable the webpage key in Web.config, which is disabled by default in .Net 4.0

<add key="webpages:Enabled" value="true" />
+5
source
<appSettings>
<add key="webpages:Enabled" value="true" />

+1
source

Windows 10 Pro IIS 10 , , , , , :

  • - Visual Studio. , > > -, - ASP.Net. , OK, , C:\inetpub\wwwroot\AspNet\Projects\Test

  • - ( "cortana" IIS, , ). _a > > - > ..., " -" . , , .

  • Web.Config - . NuGet , .

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=301879
  -->
<configuration>
  <appSettings>
    <add key="webPages:Version" value="3.0.0"/>
    <add key="webpages:Enabled" value="true"/>
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
  </system.web>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    </assemblyBinding>
  </runtime>
</configuration>
Hide result
  1. bin package.config, . , , - bin , IIS Razor/ASP. , , . , Solution Explorer. > NuGet > .

    Microsoft.AspNet.Razor -Version 3.0.0

    Microsoft.AspNet.WebPages installation package

This was enough to get * .cshtml pages that IIS 10 will display in Windows 10 Pro.

0
source

All Articles