.net core 2.0 app blocks plesk-webstat - c#

I published an aps.net core 2.0 mvc app to a shared web hosting server that uses Plesk as control panel. The app works fine. However, I got the following error message when trying to access the web statistics:
This example.com page can’t be found
No webpage was found for the web address: https://example.com/plesk-stat/webstat/
HTTP ERROR 404
I contacted their support and got the answer "the .net core application settings aren't allowing the webstats to load. We recommend you consult with an experienced website developer to customize the web.config code accordingly for the website.", but they don't know how to configure the web.config file.
I really want to make the webstat to work. Any suggestion will be appreciated.

If URL Rewrite is blocking the access, try adding this string to the <conditions> section of the rule which is affecting webstat page:
<add input="{REQUEST_URI}" pattern="^/(plesk-stat/webstat)" negate="true" />
If that does nor help, configure failed request tracing to find which exact module is performing a redirect.

Along with changes in the web.config of the ASP.Net Core site itself to send the /plesk-stat/ url to IIS, a web.config must be added in the following directory:
C:\Inetpub\vhosts\{domain.tld}\.plesk\statistics\{domain.tld}\
(replace {domain.tld} with your domain), with the following contents:
<configuration>
<system.webServer>
<handlers>
<remove name="aspNetCore" />
</handlers>
</system.webServer>
</configuration>
This has to be done by the hosting provider on the server. Maybe you should contact the support of your hosting provider.

Related

How to setup a .NET core HTTP Proxy in IIS [duplicate]

This question already has answers here:
HTTP Error 500.19 when publish .net core project into iis with 0x80070005
(11 answers)
Closed 2 years ago.
Need help to configure .NET Core HTTP proxy application on IIS on Windows 10.
I did build an proxy app to help me inject the SOAP headers before passing the request to the Final WS endpoint.
I had build this proxy because the client wont have a capability to send on headers on the request
I am mimicking the code that was shared by Andrea Chiarelli in the following link
Auth0 .NET Core Proxy
When I run the application locally on VS Code Everything works well
But soon I deployed to IIS server sing VS 2017. I ran into a problem
Web.Config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\EMCIProxy.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
I am getting a strange response that I cannot access the specific URL resource
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Detailed Error Information:
Module
IIS Web Core
Notification
Unknown
Handler
Not yet determined
Error Code
0x8007000d
Config Error
Config File
\?\C:\inetpub\EMXI_Proxy\web.config
Requested URL
http://localhost:8085/
Physical Path
Logon Method
Not yet determined
Logon User
Not yet determined
Config Source:
-1:
0:
I am trying to access the URL http://XYZ123:8085/services/SearchClient which should be routed to
https://testxyz:7443/EMXI/services"
Just want to mention I exactly have one method public async Task Invoke(HttpContext context) similar to the one on the example provided in the above URL
Any points of advice/suggestions welcome. I am trying to leave it very generic as much as possible.
I just figured out that ASP Windows Hosting Module was not installed on my machine. Just want to point to another stack question, where I found the solution
enter link description here

Deployed .Net Core 3.1 Web app on Azure shows error HTTP Error 500.35 - ANCM Multiple In-Process Applications in same Process

I've deployed a web application into our Azure, using the latest .net core 3.1 stack, the application is divided into 3 virtual apps running under the same Web app deployment and this is what seems to be causing the issue, as I can access the main application located on the root http://mywebapp/index.html but when I attempt to access any of the virtual paths IE: http://mywebapp/virtualapp/index.html the following error is displayed:
HTTP Error 500.35 - ANCM Multiple In-Process Applications in same Process
Common solutions to this issue:
Select a different application pool to create another in-process application.
Specific error detected by ANCM:
Only one in-process application is allowed per IIS application pool. Please assign the application '/LM/W3SVC/1848604257/ROOT/business' to a different IIS application pool.
Troubleshooting steps:
Check the system event log for error messages
Enable logging the application process' stdout messages
Attach a debugger to the application process and inspect
For more information visit: https://go.microsoft.com/fwlink/?LinkID=2028526
Looking through the page referenced by Microsoft the information shown for this error is :
500.35 ANCM Multiple In-Process Applications in same Process
The worker process can't run multiple in-process apps in the same process.
To fix this error, run apps in separate IIS application pools.
So my question is, Is there a way to work with multiple web applications deployed into virtual paths for a single web app in azure under .Net Core 3.1? Or is this a limitation on .Net Core 3.1 and apps are supposed to be deployed into separate web applications?
Thank you
I ended up asking Microsoft about this error and how to resolve this on the Azure platform and they pointed out that the solution is to change your web application as well as any other virtual application deployed from "InProcess" hosting model to "OutOfProcess", you can find more information about what this means here but essentially to achieve this you need to add the following value to each project file (.csproj):
<PropertyGroup>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
</PropertyGroup>
After deployment on Azure verify the change has taken place by validating that your web.config has the following settings:
<?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=".\MyApp.dll"
stdoutLogEnabled="false"
stdoutLogFile=".\logs\stdout"
hostingModel="OutOfProcess" />
</system.webServer>
</location>
</configuration>

IIS Server & ASP.Net Core - 500.19 with error code 0x8007000d on httpplatformhandler tag

I am getting the following error when I try to launch my ASP.Net Core App using IIS Server v7.5 ... I published the website (File System option in Visual Studio) to a specific directory successfully. It launches fine from approot/web.cmd file. But when I try to hook it up to IIS Server and point it to the wwwroot folder, I get the following error:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Detailed Error Information
Module IIS Web Core
Notification Unknown
Handler Not yet determined
Error Code 0x8007000d
Config Error
Config File \?\D:\WebDevelopment\UAT\creativeNamePROD\wwwroot\web.config
Requested URL http://10.2.177.226:59/
Physical Path
Logon Method Not yet determined
Logon User Not yet determined
Failed Request Tracing Log Directory
Below are two different web.config files I tried any neither one worked. When I try to get into Configuration Editor within IIS, I get an unclear error as well. Any help would be greatly appreciated!!!
<configuration>
<system.web>
<httpRuntime maxQueryStringLength="64768" maxUrlLength="65536" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxQueryString="64768" />
</requestFiltering>
</security>
<handlers>
<add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="..\approot\web.cmd" arguments="" stdoutLogEnabled="false" stdoutLogFile="..\logs\stdout.log" startupTimeLimit="3600"></httpPlatform>
</system.webServer>
</configuration>
Web.config #2 -gets the same error
<configuration>
<system.webServer>
<handlers>
<add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="..\approot\web.cmd" arguments="" stdoutLogEnabled="false" stdoutLogFile="..\logs\stdout.log" startupTimeLimit="3600"></httpPlatform>
</system.webServer>
</configuration>
I was getting this error. I fixed this error by installing the .NET Core Windows Server Hosting bundle (vs the Runtime Bundle), as described in instructions like this one.
Install the .NET Core Hosting Bundle
Install the .NET Core Hosting Bundle on the hosting system. The bundle installs the .NET Core Runtime, .NET Core Library, and the ASP.NET Core Module. The module creates the reverse proxy between IIS and the Kestrel server. If the system doesn't have an Internet connection, obtain and install the Microsoft Visual C++ 2015 Redistributable before installing the .NET Core Hosting Bundle.
As #Patrick says you can download the bundle installables from this link.
After installing that Module, my app served (i.e. no 500 error).
I see #Jørgen made this comment on OP already, so he gets credit.
EDIT Please confirm you install the Hosting bundle vs the Runtime Bundle per comment by #MDave
Did you install the .NET Core Windows Server Hosting bundle? This is needed for IIS to work as a reverse proxy for the .net core libraries. You'll find the link in this article: learn.microsoft.com/en-us/aspnet/core/publishing/iis I had the same problem before installing this on my dev machine. – Jørgen Tvedt Mar 28 at 6:31
The only solution worked for me was to install 2 more items from Microsoft dot net core library:
https://www.microsoft.com/net/download/thank-you/dotnet-runtime-2.0.6-windows-x64-asp.net-core-runtime-installer
and
https://www.microsoft.com/net/download/thank-you/dotnet-runtime-2.0.6-windows-server-hosting-installer
This worked for me, delete file: project.lock.json and run dotnet restore, restart visual studio.
I was able to solve this same problem when running in Visual Studio Community 2017 v. 15.7.1.
Had to install the latest dotnet-sdk-2.1.300-rc1-008673-win-x64.
https://www.microsoft.com/net/download/dotnet-sdk-2.1.300-rc1-windows-x64-installer
I had this problem with one .NET 6.0 site, but not another, so I knew the hosting pack was installed and functioning correctly.
The issue turned out to be that the broken site had some elements pertaining the URL Rewrite module, but the module wasn't installed.
Problem solved by either removing those elements, or installing the URL Rewrite module.

Deploy asp.net mvc website to iis 8

After developping my Website using ASP.NET, C# and the MVC pattern, i'm now to the point of deploying my site to a 'real' server (not IIS express from visual studio anymore).
So, i tried to use Web deploy, configured everything and it seem to have been properly done because i now see all my files from the server side.
But sadly, when i try to access the website, i run into error 403 (from both the client and the server), the server gives me a little more information :
"Error 403.14 - Forbidden - The server isn't configured to show the
files of this directory"
If i try to use the url as i did with Visual Studio (like, url/Views/Home/) and it returns this :
Error 500.19
28: <system.webServer>
29: <handlers>
30: <remove name="BlockViewHandler"/>
Here's the web.config files concerned : (a bit)
<system.webServer>
<handlers>
<remove name="BlockViewHandler"/>
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
I don't see where's the problem, as this website was running fine from Visual Studio.
The deploy is done in release mode.
EDIT: I enabled directory browsing, and it returns the same error 500 when i get in the 'Views' folder
There can be many reason for this issue, I also faced this problem and it was due to connection string, I was using Integrated Security=true
1) To fix the issue I added Sql User in my connection string and it solved my issue
e.g. your connection string should look like
User ID=testuser;Password=testpassword;Initial Catalog=testdb;Data Source=testserver
2) Another reason could be that your MVC project has a different .Net framework from Application pool in which you hosted your site
I solved my own problem by removing "development" features from the server, reboot, add them again and it was fine.

Deploy REST service without access to IIS

I have developed a .NET REST web service in C#. While I have plenty of C# experience, I unfortunately do not have much understanding in deploying such a service in a web hosting environment.
Due to the environment, I do NOT have access to IIS.
The advice I have been provided with by the support services of the hosting provider is as follows:
Create a subdomain of the main domain to achieve a dedicated application pool (this a requirement of the host provider)
Create a Bin folder to hold my compiled libraries of source code
Add the following to the Web.Config file:
<system.web>
<httpHandlers>
<add type="ReportRESTWebService.Service, ReportRESTWebService" verb="*" path="report" />
</httpHandlers>
</system.web>
<system.webServer>
<handlers>
<add name="report" path="report" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="File" requireAccess="Script" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
</handlers>
<directoryBrowse enabled="false" />
</system.webServer>
The above would have the effect of creating a handler mapping for the report resource on all HTTP verbs and forwarding any HTTP traffic on that resource to my ReportRESTWebService.dll for handling.
The point I am unclear on is whether the above will be satisfactory and how do I test whether the advice I am given is correct. I know that I have the site running locally but I have access to IIS so I have control over the configuration.
Hopefully somebody can help.
Thanks
If you are using Wcf Rest,then you can probably consider hosting it as as windows service
or self hosted service.
Windows Service
http://blogs.msdn.com/b/juveriak/archive/2009/03/15/rest-endpoint-hosted-in-a-wcf-windows-service.aspx
Self hosted Service
http://www.c-sharpcorner.com/uploadfile/dhananjaycoder/self-hosted-wcf-rest-service-or-hosting-wcf-rest-service-in-console-application/
It would seem, after a day of exhaustive testing, that the steps I had taken (detailed in the question) would be satisfactory.
One point to watch out for is the matching Managed Pipeline Mode for your application pool. Failure to match this up correctly with your Web.Config will result in pain.

Categories

Resources