Ich versuche, eine ASP.NET Core 2.0 WebApplication in lokalen IIS zu hosten, aber ich bekomme immer die folgende Fehlermeldung: Wert kann nicht null sein. Parametername: NameASP.NET Core 2.0 Wert kann nicht null sein. Parametername: Name
Die launchSettings.json Datei sieht wie folgt aus:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iis": {
"applicationUrl": "http://localhost/zoyotravel",
"sslPort": 0
},
"iisExpress": {
"applicationUrl": "http://localhost:56472/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Zoyo Travel": {
"commandName": "IIS",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:56473/"
}
}
}
Das Programm Klasse sieht liks dies:
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
Die Start Klasse sieht wie folgt aus:
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}
// 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();
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
{
HotModuleReplacement = true
});
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
routes.MapSpaFallbackRoute(
name: "spa-fallback",
defaults: new { controller = "Home", action = "Index" });
});
}
}
Was habe ich bisher versucht?
- Ich habe nach allen Parametern namens "Name" in der Lösung gesucht. Aber ich konnte nichts finden, was leer sein könnte.
- Wenn ich die Website in IIS Express hosten dann funktioniert es.
Das Problem scheint nicht im Code zu sein. Es ist auch eine Standard-asp.net Core 2.0 Web-Anwendung. Ich habe den Code selbst nicht berührt. Ich habe nur versucht, die Website in IIS zu hosten.
Kann mir jemand helfen?
Was hat Hosting mit dem Fehler zu tun? Sie erhalten den Fehler in Visual Studio, nicht von IIS – Tseng
Ich versuche, die Webanwendung im lokalen IIS zu hosten, wenn ich die Schaltfläche "Start" drücken, um mein Projekt auszuführen. Der folgende Fehler ist aufgetreten. –
Bitte posten Sie Programm- und Startup-Klassen –