Adding a Web.config to classic asp errors - asp-classic

I am adding a web.config file to my classic ASP project.
Here is the Web.config file,
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<asp enableChunkedEncoding="false" />
</system.webServer>
</configuration>
When I run on my localhost, I get this error,
HTTP/1.1 New Application Failed
I have added in a location path pointing to "Default Web Site" that seems to load the page, but not what I want to do, since this is not just for my local machine.
I'm not sure where to go from here to get the page to load.

Related

HTTP Error 500.19 - internal server error code 0x8007000d

I created an ASP.NET Core 5.0 Web API project. I can execute and run the application in IIS Express. If I deploy the app, then I get the following error:
Server Error in Application "application name"
HTTP Error 500.19 – Internal Server Error
HRESULT: 0x8007000d
Description of HRESULT
The requested page cannot be accessed because the related configuration data for the page is invalid.
The official MS support page referenced two causes:
This problem occurs because the ApplicationHost.config or Web.config
file contains a malformed or unidentified XML element. IIS can't
identify the XML elements of the modules that are not installed. For
example, IIS URL Rewrite module.
Resolution
Use one of the following methods:
Delete the malformed XML element from the ApplicationHost.config or Web.config file.
Check the unidentified XML elements, and then install the relevant IIS modules.
I installed IIS URL Rewrite module without a effect.
My web.config comes with my build/deploy process. For configurations I use the appsettings.json. So I don't know if and what have propably to change in my web.config. Any suggestions?
...\inetpub\wwwroot\MyApi\web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\MyApi.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: f659debd-cac7-4ce5-b2fe-d1a440a87811-->
You should install hosting bundle version of .Net to add support .Net core runtime in IIS on server
https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-aspnetcore-5.0.13-windows-hosting-bundle-installer
all downloads:
https://dotnet.microsoft.com/en-us/download/dotnet/5.0

IIS deploy php application in subfolder of ASP.NET core NOPCommerce

In NopCommerce 4.0 application I am trying to deploy an PHP application in subfolder.
So that the URL for subfolder is like mydomain.com/blog/.
I have added only one file to the blog folder as index.php.
I want the url for this page to be mydomain.com/blog/index.php.
Please note that I have already remove the blog from the RouteProvider.cs.
How can I process the index.php in the NOP 4.0 folder?
I got this issue solved by removing the route from the code and adding the below code in the web.config of the sub-folder
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<remove name="aspNetCore" />
</handlers>
</system.webServer>
</configuration>

Hardening uploads folder in IIS breaks images

My site loads a bunch of images from the uploads folder, using direct URLs, such as:
http://www.example.com/wp-content/uploads/some.image.png
I'm trying to figure out a remote script execution issue, and one of the things recommended on https://codex.wordpress.org/Hardening_WordPress is to prevent script execution in the uploads folder, using the .htaccess file:
# Kill PHP Execution
<Files ~ "\.ph(?:p[345]?|t|tml)$">
deny from all
</Files>
My site is running on IIS, so to acheive the same result, I removed the PHP handler for the uploads folder and all it's subfolders:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<remove name="php-7.1.7" />
</handlers>
</system.webServer>
</configuration>
However, if I use the web.config file, loading an image using a direct URL leads to a http 500 error. Consequently, themes don't load properly.
How would I go about preventing PHP script execution in the uploads folder, without breaking static file loading?
Adding <add name="StaticFile" /> below <remove name="php-7.1.7" /> makes no difference.
Create a web.config inside upload folder and paste in the following xml:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers accessPolicy="Read">
</handlers>
</system.webServer>
</configuration>

HTTP/1.1 New Application Failed

i just moved from my old host to Godaddy, which seems to be a worst web host with no support.
i moved my asp website (written in classic asp) to the new godaddy windows hosting. but when i run the site i get the below error
HTTP/1.1 New Application Failed
this site worked perfectly with my previous host.
below is what i have in my web.config file
<?xml version="1.0"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>
</configuration>
can someone tell me why am i getting that error and how can i fix it?
any help will be appreciated.
I had the same issue moving a website from one hosting account (classic windows) to another (plesk), both on GoDaddy. After much headache troubleshooting, I managed to fix it by removing the whole <asp> tag from the web.config file;
<!-- <asp scriptErrorSentToBrowser="true"/> -->
IIS 8 (only option in plesk) does not support this option altogether and configuring detailed error messaging is done differently using:
<httpErrors errorMode="Detailed" existingResponse="PassThrough" />
You can find further instructions on this GoDaddy support page
I just encountered the same error this morning after renaming some Websites in IIS. A restart of IIS got my sites up and running again in seconds. Presumably the .config files are read on startup and 'likely' the cause of this error for me.

redirect from application(on root domain level) to subapplication

My hosting supports only web.config IIS configuration. I want to redirect my
http://domain -> http://domain/X
and here is my try
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpRedirect enabled="true" destination="http://domain/X/" />
</system.webServer>
</configuration>
it works, but the trouble it works for all sites and when I already on http://domain/X/ it still working so I'm getting recursion http://domain/X/X/X/X/X/X/X etc...
Temporary solution is to put
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpRedirect enabled="false" />
</system.webServer>
</configuration>
into http://domain/X and http://domain/Y etc... but when I go to the http://domain/Y/Z it anyways redirects me to http://domain/X/Z/ (so hell I don't really want to put this in any folder)
So I think I need to fix first redirection (Somehow) to make it works only for http://domain/
thank you.
You can try setting childOnly attribute - as per documentation, this would redirect only if the file name is present in the url. So only urls of form http://domain/<file name> would get redirected to http://domain/X/<file name> and that should solve your issue. For redirecting http://domain/, you may use a default document redirecting to http://domain/X.
You may also look at URL Rewrite module - see http://learn.iis.net/page.aspx/460/using-the-url-rewrite-module/ (but of course, it will not issue HTTP redirects if that is the need)

Resources