question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MockServer not starting

See original GitHub issue

Hello I am trying to use WireMock but I am having a problem and I don´t know why. My project is .NET Framework 4.52 and I installed the last version of WireMock.Net.

When I Start the server with .Start() method this is the error:

Initialization method Tests.TestShould.OnTestInitialize threw exception. WireMock.Exceptions.WireMockException: Service start failed with error: Se produjo una excepción en el destino de la invocación. ---> System.Reflection.TargetInvocationException: Se produjo una excepción en el destino de la invocación. ---> System.Net.HttpListenerException: El parámetro no es correcto. en System.Net.HttpListener.AddAllPrefixes() en System.Net.HttpListener.Start() en Microsoft.Owin.Host.HttpListener.OwinHttpListener.Start(HttpListener listener, Func2 appFunc, IList1 addresses, IDictionary2 capabilities, Func2 loggerFactory) en Microsoft.Owin.Host.HttpListener.OwinServerFactory.Create(Func2 app, IDictionary2 properties) --- End of inner exception stack trace --- en System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) en System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) en System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) en Microsoft.Owin.Hosting.ServerFactory.ServerFactoryAdapter.Create(IAppBuilder builder) en Microsoft.Owin.Hosting.Engine.HostingEngine.StartServer(StartContext context) en Microsoft.Owin.Hosting.Engine.HostingEngine.Start(StartContext context) en Microsoft.Owin.Hosting.WebApp.StartImplementation(IServiceProvider services, StartOptions options, Action1 startup) en WireMock.Owin.OwinSelfHost.StartServers() — End of inner exception stack trace — en WireMock.Server.WireMockServer…ctor(IWireMockServerSettings settings) en WireMock.Server.WireMockServer.Start(Nullable1 port, Boolean ssl) en Tests.TestShould.OnTestInitialize() en C:\Dev\Tests\TestShould.cs:línea 36

Any idea? Thanks.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
StefHcommented, Apr 17, 2020

A new official nuget will be released shortly.

1reaction
StefHcommented, Apr 17, 2020

Yes I can confirm your issue:

Test method UnitTestProject_net452.UnitTest1.TestMethod1 threw exception: 
WireMock.Exceptions.WireMockException: Service start failed with error: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.HttpListenerException: The parameter is incorrect
    at System.Net.HttpListener.AddAllPrefixes()
   at System.Net.HttpListener.Start()
   at Microsoft.Owin.Host.HttpListener.OwinHttpListener.Start(HttpListener listener, Func`2 appFunc, IList`1 addresses, IDictionary`2 capabilities, Func`2 loggerFactory)
   at Microsoft.Owin.Host.HttpListener.OwinServerFactory.Create(Func`2 app, IDictionary`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, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.Owin.Hosting.ServerFactory.ServerFactoryAdapter.Create(IAppBuilder builder)
   at Microsoft.Owin.Hosting.Engine.HostingEngine.StartServer(StartContext context)
   at Microsoft.Owin.Hosting.Engine.HostingEngine.Start(StartContext context)
   at Microsoft.Owin.Hosting.WebApp.StartImplementation(IServiceProvider services, StartOptions options, Action`1 startup)
   at WireMock.Owin.OwinSelfHost.StartServers()
--- End of inner exception stack trace ---
    at WireMock.Server.WireMockServer..ctor(IWireMockServerSettings settings)
   at WireMock.Server.WireMockServer.Start(Nullable`1 port, Boolean ssl)
   at UnitTestProject_net452.UnitTest1.TestMethod1() in C:\Users\Heyenrath SWW\Downloads\UnitTestProject-net452\UnitTest1.cs:line 13
Read more comments on GitHub >

github_iconTop Results From Across the Web

Mock Server doesn't start after updating to 5.11.0 #2984
We're having issues when updating to the latest version of the Mock Server and its Java client (5.11.0) with Testcontainers. The Problem. We...
Read more >
Running MockServer
MockServer can be run using the MockServerRule. The MockServerRule starts MockServer (for both mocking and proxying) on a free port before the any...
Read more >
Running The Proxy
The Maven plugin has the following goals: start - start MockServer, do not block, but stop when build ends; stop - stop a...
Read more >
The mock server doesn't seem to run even if I have ...
It looks like the provider rule is not running, so the mock server is not being started.
Read more >
MockwebServer doesn't mock http call
When I launch the unit test, the http call is not mocked by Mockwebserver. I get a response from my real server and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found