0

ImageI am setting up my web application (working) in the Windows Server 2016 Environment which has the IIS role set up. My application outputs the following error when I try to run it: "The page you are requesting cannot be served because of the extension configuration" error.

I have a simple application that has a label and needs to change the text of label on Page Load. My .aspx files work if I don't mention the CodeBehind file .aspx.cs file .

I believe this is a case of .aspx.cs file access. I have a much bigger application and I made this small one for asking this question. My guess is that I cannot access my .aspx.cs file.

I have tried adding "allow fileExtensions=".cs" ....." and this add cs to the list of allowed files. I have also tried using the aspnet_regiis -i to install asp.net which worked correctly.

As for my setup, I have added the IIS role, installed the ASP.NET 4.5 and its Extensible feature and also ASP.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Intro.aspx.cs" Inherits="Intro" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
   <head runat="server">
   </head>
<body>
    <asp:Label . ...../>
</body>
</html>

UPDATE :Thank you all for your responses. This stackoverflow community is great . As for the solution I enabled .NET 3.5 features , .net 4.5 features, and all features related to a Web Server . A more concrete answer would help but this worked for me. Thank you all .

Web.config

survivor
  • 1
  • 3
  • You could possibly enable the fault tracing in IIS and see the full error. It is also possible that web features over Server Manager is not installed. – Hozikimaru Mar 23 '19 at 04:13
  • @Hozikimaru , What other steps do I have to take other than the ones listed on https://learn.microsoft.com/en-us/iis/application-frameworks/scenario-build-an-aspnet-website-on-iis/configuring-step-1-install-iis-and-asp-net-modules If I missed something, I can fix it now. I thought that's all I need to do. Researched online and found some fixes(mentioned in my post) that did not work for me. – survivor Mar 23 '19 at 04:19
  • DO NOT `"allow fileExtensions=".cs"`! Does your site run locally when you debug from Visual Studio? if it does, this is a deployment issue, how did you deploy the site to IIS? – Chris Schaller Mar 23 '19 at 07:02
  • @ChrisSchaller There are just two files in the "Default Web Site" that is provided by default by the IIS Manager - 'Intro.aspx' and 'Intro.aspx.cs' . I don't think it can be a deployment issue. You can try reproducing the environment too . I think that I am missing something here. I just followed instructions on https://learn.microsoft.com/en-us/iis/application-frameworks/scenario-build-an-aspnet-website-on-iis/configuring-step-1-install-iis-and-asp-net-modules to set up the IIS and then just created two pages inside in the Default Web Site – survivor Mar 23 '19 at 13:21
  • You should check other threads on 404.3, but exposing .cs is not the solution. – Lex Li Mar 23 '19 at 14:53
  • @survivor Have you tried publishing your web application and then place the published files on the server? – Mohsin Mehmood Mar 23 '19 at 17:48
  • Did you try the solution https://stackoverflow.com/questions/4388066/the-page-you-are-requesting-cannot-be-served-because-of-the-extension-configura – Hainan Zhao Mar 24 '19 at 03:53
  • @ZhaoHainan I did see that . Thank you for your response. – survivor Mar 24 '19 at 17:12
  • @MohsinMehmood I am using a Windows 2016 Environment with the IIS Server . If it doesn't work on my local I don't think it will work anywhere else . – survivor Mar 24 '19 at 17:13

0 Answers0