How to allow aspx files

Vote:
 

I have a website running Episerver CMS hosted in an Azure webapp.

My goal is to display a 404 page when a user goes to www.mysite.com/test.aspx, This works locally on my IIS site, but when deployed to Azure instead of a 404 I get a 500 exception:

System.Web.HttpException (0x80004005): The file '/test.aspx' does not exist. at System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath
 at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate
 at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate
 at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound
 at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp
 at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath
 at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute(
 at System.Web.HttpApplication.<>c__DisplayClass285_0.<ExecuteStepImpl>b__0(
 at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step
 at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Any recommendations?

#199678
Dec 05, 2018 10:10
Vote:
 

Hi Rasmus,

Have you checked that your test.aspx file is actually deployed to your Azure web app (do you have 'build action: content' for your test.aspx)?

The exception says the file doesn't exist which would indicate that the aspx is not deployed.

#199737
Dec 08, 2018 20:17
Vote:
 

do you have any custom errors configured for azure deploy?

#199740
Dec 09, 2018 18:45
Vote:
 

Thanks for your suggestions.

Yes, the test.aspx file is deployed

Yes, there is custom errors configured.

I solved the problem by added a handler to 

<system.webServer>

<handlers>

<add name="AspxHandler" preCondition="integratedMode" verb="GET" path="*.aspx" type... />

#199998
Dec 20, 2018 8:13
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.