C# .NET核心Web API未经更改返回404的urlhttp://localhost:8083/api/values 关于IIS

C# .NET核心Web API未经更改返回404的urlhttp://localhost:8083/api/values 关于IIS,c#,C#,未经更改的.NET核心Web API在IIS上返回404的url 找不到正在获取的404.0 我该怎么办 使用web.config解决 <?xml version="1.0" encoding="utf-8"?> <confenter code hereiguration> <location path="." inheritInChildApplications="false"> <system.webServer> &l

未经更改的.NET核心Web API在IIS上返回404的url

找不到正在获取的404.0


我该怎么办

使用web.config解决

<?xml version="1.0" encoding="utf-8"?>
<confenter code hereiguration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess">
        <environmentVariables>
          <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
        </environmentVariables>
      </aspNetCore>
    </system.webServer>
  </location>
</configuration>

你好!欢迎来到stackoverflow。请不要发布-他们值得投反对票。请显示您的startup.csI忘记我更改了startup.cs的配置…为什么编辑粘贴实际控制器代码,然后粘贴启动代码的图像?如果您想让人们查看代码,只需包含实际代码。请提醒我,这些代码大部分是代码,这是我的第一个问题,对不起,请原谅我
public class Startup
{
    public Startup(IConfiguration configuration)
    {
        Configuration = configuration;
    }

    public IConfiguration Configuration { get; }

    // This method gets called by the runtime. Use this method to add services to the container.
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
    }

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
        else
        {
            // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
            app.UseHsts();
        }

        app.UseHttpsRedirection();
        app.UseMvc();
    }
}
<?xml version="1.0" encoding="utf-8"?>
<confenter code hereiguration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess">
        <environmentVariables>
          <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
        </environmentVariables>
      </aspNetCore>
    </system.webServer>
  </location>
</configuration>