Kentico - Global.asax file issue after publishing - kentico

I have installed a new Kentico web application and I can browse the site without any problem. This site is hosted in IIS, Now I want to add some customization and created another web application application using MVC and registering routes etc in application start of global.asax event.
Kentico project also has a global.asax file and it contains some code logic.
When I publish my custom web project, It overwrites the existing default Kentico global.asax with global file from my application and application breaks.
Is there any way to have a 2 different global.asax file in a web application with different names? I want both global files should execute separately.

No, I don't believe you can do that. What you can do is publish your MVC site to an application in IIS instead. You might find the following article from Kentico helpful: Creating virtual directories and application pools in IIS 7.5 and 7.0

Related

How to resolve 404 error on deploying .net core web API

Hi I have done following steps while hosting my .net core web API in IIS of my laptop. But when I browse the URL I get 404 error.
Sample URL: http://localhost/Myapp/api/user
Help will be much appreciated! If need any further info let me know.
Steps:
Install Install the .NET Core Hosting Bundle 2.2.5
Hosted web api in IIS with defaul 80 port number without any hostname
Created new application pool with No MANAGED CODE as .NET CLR Version.
To host .NET Core Web API in IIS follow below steps:
Publish the Web APIs to Your Local Folder
for example, D:\testcoreapi
Install Microsoft .NET Core Windows Server Hosting Bundle File
ASP.NET Core Module Configuration Reference
Open IIS Create One Application Pool of No Managed Code
Create Web Site to point to the local folder of your published.
Note:
Do not forget to select an application pool which you created before with no managed setting.
If you are still not able to browse the site select your site from connection node in iis.
right click on site and select "Explore" and make sure that you select right folder.
For more detail you could follow the below article:
https://jakeydocs.readthedocs.io/en/latest/publishing/iis.html
Regards,
Jalpa

How can I install an AspNet Core application in a subdirectory?

I have setup a web application in IIS. There are no files or anything in it.
.../wwwroot/automock
Next, in IIS in a subfolder called v1 I setup an aspnetcore web application that points to my publish files in another directory.
I would like my application to be available at:
http://www.[domain].com/v1/
I hope then to be able to deploy multiple versions in different sub-folders.
When, I request the page at http://www.[domain].com/v1 I get 404s for all of my javascript resources.
How, can I configure my aspnetcore application to serve these files correctly?
If it is IIS related how can I setup IIS to serve the web application properly from a subfolder?

Azure app service: how to add custom Handler mapping to process TXT files?

I want to use ASP.Net Directives in a TXT file. Typically, I would add a handler mapper for that. But how can I do that in Azure App Service? Adding the following handler (D:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll):
generates the following exception:
Most likely causes: IIS received the
request; however, an internal error occurred during the processing of
the request. The root cause of this error depends on which module
handles the request and what was happening in the worker process when
this error occurred. IIS was not able to access the
web.config file for the Web site or application. This can occur if the
NTFS permissions are set incorrectly. IIS was not able to
process configuration for the Web site or application. The
authenticated user does not have permission to use this DLL.
The request is mapped to a managed handler but the .NET
Extensibility Feature is not installed.
Things you can
try: Ensure that the NTFS permissions for the
web.config file are correct and allow access to the Web server's
machine account. Check the event logs to see if any
additional information was logged. Verify the permissions
for the DLL. Install the .NET Extensibility feature if the
request is mapped to a managed handler. Create a tracing
rule to track failed requests for this HTTP status code. For more
information about creating a tracing rule for failed requests, click
here.
and I don't think there is much I can do with the suggestions.
So what's the right way to map static file to ASP.Net pipeline in Azure App Services?
In Azure web service, we don't have to use aspnet_isapi.dll to use ASP.Net pipeline because the built-in server is IIS. We can see below screenshot, i published a ASP.NET Core to Azure web app, and we can see the Microsoft.Owin.Host.SystemWeb.dll under the root folder, this means that my ASP.NET Core application is hosted in IIS. (Besides IIS, are there any other better servers to support OWIN?).
Thus, if you are using ASP.NET Core and you want to use IIS pipeline, i think it is impossible because the IIS is just a reverse proxy server in this situation. You need to delete the Microsoft.Owin.Host.SystemWeb.dll and modify the web.config file (I tried and worked) but doing this will cause your ASP.NET Core application crashing.
If you are using ASP.NET Framework or just a simple static web, we can do it with our code and web.config.

How to setup iis in Azure web app service with Net Core 2 app?

I develop simple Web Api on Net Core 2 and add Angular app to it (inside wwwroot folder) and publish it from my VS 2017 IDE to Azure Web App Service. All work fine, but when I reload page of my app in browser, server can't find route. So It often happens when iis not setup for SPA, It's described in https://angular.io/guide/deployment, I must configure the server to return the application's host page (index.html) when asked for a file that it does not have. How I can setup server node of iis in Azure Web App Service (web.config in Net Core 2 was deleted).
I am afraid you cannot achieve this.
Cause: Azure App Services runs IIS so it behaves mostly the same as local IIS, routing requests using a native module called AspNetCoreModule. So, it needs your published web.config file. Even though you deleted the web.config file, Azure would also generate a new web.config file to be used.(Though I don't understand why you delete the web.config file)
Solution:
Even you can upload the web.config file to Azure again, I'm afraid of that it will be ignored and doesn't work. So, I suggest you redeploy your website which contains web.config file to Azure and configure it well.
Additional: Azure Web App service is a kind of PaaS. So, if you want to install IIS manually, you can choose to host your website on a Windows Azure VM.

How to Setup Local Developer Environment for IIS Express, Web API, and an MVC Web project?

I'm looking for a solution to facilitate for running a local solution that has a ASP.NET MVC Web Project and a Web API REST service project.
Setting multiple startup projects is saved in the .suo file, and is not checked into the repository since it is a specific user settings file. Also, IIS Express is configured outside the solution in the current's user's directory.
Any suggestions on how to support this multiple startup project scenario in a team scenario ensuring that the same ports are assigned to everyone that brings down the repository from source control?
Note: I do not want to move the Web API controllers to the web solution. The segregation of those two projects is important in this architecture.

Resources