Remove HTTP header on ASP.Net Core 2.2 InProcess - asp.net-core-2.2

I have an ASP.Net Core 2.2 Web API project that is using InProcess hosting model. I need to remove certain HTTP headers from the response such as Server and X-Powered-By. All the answers I have found lead to ConfigureKestrel() or manually editing the web.config file. However:
I am not using Kestrel since I am InProcess
The web.config is auto-generated when publishing the app
Thanks for your help.

Related

dotnet core 2.2 web api added as application is not working in IIS

I have created two projects. One is front end which is developed by using angular and backend is developed in dotnet core web api. Now i tried to publish into Web server (IIS). I have created website and mapped to frontend project and then i added web api as add application. Now i tried to access webapi but it is not working. By seeing physical path is changed wrongly.
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable

Is there any way to see actual application error in a website hosted in IIS?

A legacy .Net webform application is hosted in IIS is running fine in old server having .Net framework 2.0 in it. I don't have source code of the application. I have just existing published DLL which i have copied from old server to a new server having .Net 4.7 framework by default and hosted it in new server's IIS.
While browsing the application, it is showing an default configured Error.aspx page which developers may have configured. So, in case of any error the application will navigate to Error.aspx page.
I am not able to figure out the actual .net error.
How can i get the actual error or is there any way to debug that ?
You can find errors in iis log (default path is %SystemDrive%\inetpub\logs\LogFiles).
Also you can enable detailed error message in browser. Link

WCF Service not working in IIS after Web app migration

I migrated my web app hosting a WCF Service from Windows 10 to Windows Server 2012. I followed the steps below:
Copied the folder where the Web App's files are to the new machine.
Installed all ASP.NET and WCF features.
Created a new application targeting the folder containing the files of the application.
When I try to run the service I get
HTTP 404 Error, The Resource cannot be found.
When I just target the svc file I get
Metadata publishing for this service is currently disabled.
I don't get this message when hitting the same URL in the original machine. Instead I get the regular screen telling me that I have created a service.
When hitting the root folder on a browser, in the original machine I get a white screen but in the new machine I get
A default document is not configured for the requested URL, and directory browsing is not enabled on the server.
As far as I can say, all configuration parameters are the same in both machines.
I want to add a detail that might help. When I restart the site on the original machine, the first time I request the service, I wait a few seconds for the site to compile and run. On the new machine this doesn't seem to happen. It may be that the code-behind is not loaded at all.
Please check if your IIS has svc handler added.
WCF services don’t run on IIS with the default configuration, because the webserver doesn’t know, how to handle incoming requests targeting .svc files. You can teach it in two steps:
Add a new MIME type:
Extension: .svc
MIME type: application/octet-stream
Add a new Managed HTTP Handler:
Request path: *.svc
Type: System.ServiceModel.Activation.HttpHandler
Name: svc-Integrated
Refresh your website/web application
References:
http://gyorgybalassy.wordpress.com/2012/09/24/publishing-a-wcf-service-on-iis8/
http://proq.blogspot.hk/2012/09/wcf-on-iis-and-windows-8.html
http://forums.iis.net/t/1200413.aspx?+svc+missing+can+t+find+Module+to+load+within+Handler+Mapping+IIS+8+0
Enable FTP Server from Control Panel->Programs and Features
http://www.kebabshopblues.co.uk/2013/09/20/hosting-a-wcf-service-library-project-in-iis-8-0-windows-8-0-net-4-5/
From Control Panel|Programs and Features, enable the following:
Internet Information Services (a number of contained items will be selected automatically, but not all, most notably the FTP Server);
‘HTTP Activation’ under ‘.Net Framework 4.5 Advanced Services | WCF
Services’ (there is a fairly similar option ‘Windows Communication
Foundation HTTP Activation’ under the ‘.Net Framework 3.5 (includes
.NET 2.0 and 3.0’ which I guess would be necessary if you were
targeting an earlier version of .Net);
There may be some features that support WCF that are not yet enabled in IIS. I have followed your steps to deploy the existed WCF service and consume the service successfully. Here are my features I have enabled in IIS.
Result.
Feel free to let me know if there is anything I can help with.

Can I use Kestrel web server in an existing .NET 4.5 process?

I'm looking for a .NET web server that can be incorporated into existing process without much fuss. The process currently runs on .net 4.5 on Windows 10. Can I use the kestrel http server in this context?
Can anyone point me to a "hello world" level example of using Kestrel?
Updated...
I found a minimal hosting example in the ASP.NET docs, but it won't compile. Since the docs seem in error, I'm logging it as an issue for this on GitHub.

HTTP verb used to access this page is not allowed Web Api IIS 7

I should preface this by stating that my experience with IIS is very limited. I am trying to deploy a Web API service on IIS 7.5 on an Azure server running Windows Server 2008 R2 Datacenter. Whenever I post to the service using Postman I get an "HTTP verb used to access this page is not allowed" error. Looking at the response headers through fiddler I see the following line under the Miscellaneous category: "Allow: GET, HEAD, OPTIONS, TRACE".
I deployed this application using a WebDeploy package and configured it so it would be a virtual directory under the Default Web Site. My current IIS configuration is as follows:
Some of the things I've tried include:
Verifying that WebDAV is not installed
Edited the following Handler mappings for the Default Web Site and the Sync project to allow all verbs: ExtensionlessUrlHandler-Integrated-4.0, ExtensionlessUrlHandler-ISAPI-4.0_32bit, ExtensionlessUrlHandler-ISAPI-4.0_64bit, and ISAPI-dll
The default Web Site and the Sync app are both running under the DefaultAppPool which is set to .NET Framework 4.0.
The Sync App is targeting .NET framework 4.5
I've looked at Request Filtering for the Default Web Site and the Sync app and made sure that the POST verb is allowed under the HTTP Verbs section.
I am at a loss as to what to look at next so any hints are greatly appreciated.
After working with a colleague, we managed to get the web api service running to an extent. It currently shows an error message but it's one that we created which means the code is actually being hit. We had to give database permissions to the IIS_APPPOOL\DefaultAppPool user and re-register .net 4 with iis via the aspnet_regiis command.

Resources