System.Net.HttpListenerException: Fehler beim hören auf dem Präfix 'http://localhost:8080

Ich bin mit dem folgenden code aus Scott Allen ASP.Net Grundlagen-Kurs

using System;
using Microsoft.Owin.Hosting;
using Owin;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string uri = "http://localhost:8080";
            using (WebApp.Start<Startup>(uri))
            {
                Console.WriteLine("Started!");
                Console.ReadKey();
                Console.WriteLine("Stopping!");
            }
        }
    }

    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            app.UseWelcomePage();
            //app.Run(
            // ctx => ctx.Response.WriteAsync("Hello Owin!"));
        }
    }
}

Jedoch wenn ich die Konsole ausführen, app bekomme ich eine Nachricht,

    Unhandled Exception: System.Reflection.TargetInvocationException: Exception has
been thrown by the target of an invocation. ---> System.Net.HttpListenerExceptio
n: Failed to listen on prefix 'http://localhost:8080/' because it conflicts with
 an existing registration on the machine.
   at System.Net.HttpListener.AddAllPrefixes()
   at System.Net.HttpListener.Start()
   at Microsoft.Owin.Host.HttpListener.OwinHttpListener.Start(HttpListener liste
ner, Func`2 appFunc, IList`1 addresses, IDictionary`2 capabilities, Func`2 logge
rFactory)
   at Microsoft.Owin.Host.HttpListener.OwinServerFactory.Create(Func`2 app, IDic
tionary`2 properties)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments,
 Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Objec
t[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke
Attr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.Owin.Hosting.ServerFactory.ServerFactoryAdapter.Create(IAppBuild
er builder)
   at Microsoft.Owin.Hosting.Engine.HostingEngine.StartServer(StartContext conte
xt)
   at Microsoft.Owin.Hosting.Engine.HostingEngine.Start(StartContext context)
   at Microsoft.Owin.Hosting.Starter.DirectHostingStarter.Start(StartOptions opt
ions)
   at Microsoft.Owin.Hosting.Starter.HostingStarter.Start(StartOptions options)
   at Microsoft.Owin.Hosting.WebApp.StartImplementation(IServiceProvider service
s, StartOptions options)
   at Microsoft.Owin.Hosting.WebApp.Start(StartOptions options)
   at Microsoft.Owin.Hosting.WebApp.Start[TStartup](StartOptions options)
   at Microsoft.Owin.Hosting.WebApp.Start[TStartup](String url)
   at ConsoleApplication1.Program.Main(String[] args) in e:\EShared\Dev2015\WebA
ppScottAllen\ConsoleApplication1\ConsoleApplication1\Program.cs:line 12
Press any key to continue . . .

Lief ich den Ressourcenmonitor vom Task-Manager die Registerkarte Leistung aus und können sehen, dass es 2 Einträge, die auf Listening-Ports für 8080.

Beide haben Image=System PID=4, IPv6 unspecified, Protokoll TCP, Firewall-Status Nicht erlaubt, nicht eingeschränkt

Ich bin neu auf-Listening-Ports, wie bekomme ich den code?

Ich Frage mich, wenn ich den port schließen, stackoverflow.com/questions/8688949/... ich brauche eine gute Referenz, die auf ports und sockets zu lernen
Ports & TCP-Verkehr youtube.com/watch?v=AXrFCbD4-fU

InformationsquelleAutor Kirsten Greed | 2015-04-18

Schreibe einen Kommentar