简体   繁体   中英

How to set up Web.config: MVC

When I try to access a website that I built using MVC, I am met with error 500. I contacted my hosting providers and they said the issue was with my web.config file. Problem with that is there wasn't one in the project when I created it through Visual Studio.

I followed this guide to add one: How to: Create Web.config Files . Which is provided by Microsoft.

I'm at a complete loss here as I don't know what sort of info is needed or how to configure it so that it will work.

These are the current contents of the file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>    
  <!-- To customize the asp.net core module uncomment and edit the following section. 
  For more info see https://go.microsoft.com/fwlink/?linkid=838655 -->
  <!--
  <system.webServer>
    <handlers>
      <remove name="aspNetCore"/>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
    </handlers>
    <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
  </system.webServer>
  -->
</configuration>

What I'm asking for is a bit of direction as to what I need to do, and why this wasn't included in the website to begin with.

You need to clarify with your provider do they support asp.net core since it has its own runtime library.

Also web.config is related to classical ASP.NET framework not for ASP.NET Core. Try to create app with any .NET version 4.x in visual studio. Within template you'll see web.config.

If you still want to use .net core it uses slightly different config mechanisms. You can read more about in www.asp.net tutorial section of asp.net core

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM