MVC websites can be run on our Windows Shared Hosting environment, but they must be configured correctly. The information below - "Steps", also applies to .NET CORE.
A Note On .NET CORE
You must compile your projects without EXEs; we do not allow EXEs to execute on our systems.
To facilitate this you would deploy your website as a "Framework-dependent deployment"; refer to the following for more information:
Note that "this is the default deployment model for .NET Core apps", so if you are deploying with EXEs you are working as a "self-contained deployment".
Viewing Windows Errors
You can show remote errors by entering the following into your Web.Config file:
<httpErrors errorMode="Detailed" />
You may also need to set logging to file (as below) to see some errors.
You can enable logging to file, for your website/application, via the following directive:
<aspNetCore processPath="dotnet" arguments=".\WebApplication1.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
- You should ensure that you change "WebApplication1.dll" with the name of your executing project file, logging will not take place correctly otherwise.
- You need to ensure the location that is being written to is writable by your website/application: you would set this via "File Manager" in your account.
Firstly, they must be running on our Windows 2012 servers.
You can check this in your control panel by going to Home > Hosted Domains > [Domain Name] > Web
You'll see a screen like these below:
The Resource needs to be IIS Shared Hosting 2012.
If it's set to 2008, you will need to change to a webspace that is running 2012.
Once it's on a 2012 webspace, you need to ensure that the Website Configuration is set correctly.
Home > Hosted Domains > [Domain Name] > Website Configuration
SSI set to on.
ASP needs to be off, with ASP.NET set to 4.5.
(IMPORTANT) ISAPI rewrite needs to be off.
You'll need FTP on.
PHP and ActivePerl can be turned on if required, and should be running as CGI applications.
You must also ensure the following section for modules is included system.webServer section of your web.config file:
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" preCondition="" />
The Roslyn Compiler cannot be used on our Shared Hosting.
There is a way to compile the site without using Roslyn.
1. Open NuGet Package Manager from tools menu or Use Manage NuGet Packages for Solution. This will allow you to uninstall packages from the project which is using that package.
2. You need to uninstall Microsoft.CodeDom.Providers.DotNetCompilerPlatform using the following command in the Package Manager Console:
Uninstall-package Microsoft.CodeDom.Providers.DotNetCompilerPlatform <Your Web project name>
3. You can now rebuild, and republish the project. In your web project publish profile settings, uncheck "Allow precompiled site to be updatable". You can find this under Settings > Precompile during publishing > Configure.