Question: Why the Microsoft.Owin.Host.HttpListener is not referenced in the dll, which uses WireMock? #105

Closed
opened 2025-12-29 14:22:34 +01:00 by adam · 3 comments
Owner

Originally created by @o7g8 on GitHub (May 17, 2018).

Hello,

I know it's not WireMock's fault, but maybe someone may shed a light to the weird situation described here https://stackoverflow.com/questions/30050588/system-missingmemberexception-the-server-factory-could-not-be-located-startin

I have faced the issue myself: UTs using the WireMock execute fine in VisualStudio but fail in command line and on the CI server.
The UT project has the full bunch of references, Owin included, as expected:
image

But the resulting dll has only few of the references (the picture is taken from dotPeek):
image

It's so weird, why not all the references from VS are there?

Here are the references of the WireMock.dll itself:

image

I wonder if the WireMock code can ensure that Microsoft.Owin.Host.HttpListener is referenced by the the WireMock.dll? In this case consumers of WireMock won't get the nasty Ut crashes and won't need to add the ugly workaround code in UTs.

BTW the workaround with typeof(OwinHttpListener) works and the UT dll gets the Microsoft.Owin.Host.HttpListener in its References.

Originally created by @o7g8 on GitHub (May 17, 2018). Hello, I know it's not WireMock's fault, but maybe someone may shed a light to the weird situation described here https://stackoverflow.com/questions/30050588/system-missingmemberexception-the-server-factory-could-not-be-located-startin I have faced the issue myself: UTs using the WireMock execute fine in VisualStudio but fail in command line and on the CI server. The UT project has the full bunch of references, Owin included, as expected: ![image](https://user-images.githubusercontent.com/1987306/40188491-58f9bc58-59fa-11e8-9ff9-e9f45d79c30f.png) But the resulting dll has only few of the references (the picture is taken from dotPeek): ![image](https://user-images.githubusercontent.com/1987306/40188583-8d269b22-59fa-11e8-89a4-f4beb36d0d58.png) It's so weird, why not all the references from VS are there? Here are the references of the WireMock.dll itself: ![image](https://user-images.githubusercontent.com/1987306/40188924-5e762f08-59fb-11e8-99a6-9c8d106ba052.png) I wonder if the WireMock code can ensure that `Microsoft.Owin.Host.HttpListener` is referenced by the the `WireMock.dll`? In this case consumers of WireMock won't get the nasty Ut crashes and won't need to add the ugly workaround code in UTs. BTW the workaround with `typeof(OwinHttpListener)` works and the UT dll gets the `Microsoft.Owin.Host.HttpListener` in its References.
adam added the question label 2025-12-29 14:22:34 +01:00
adam closed this issue 2025-12-29 14:22:34 +01:00
Author
Owner

@StefH commented on GitHub (May 18, 2018):

I noticed this issue also, so for my example net452 console app, I did add this reference, see https://github.com/WireMock-Net/WireMock.Net/blob/master/examples/WireMock.Net.ConsoleApplication/packages.config#L4

I think there was a reason why I did not add this library to the WireMock and WireMock.StandAlone projects. I'll investigate further...

@StefH commented on GitHub (May 18, 2018): I noticed this issue also, so for my example `net452` console app, I did add this reference, see https://github.com/WireMock-Net/WireMock.Net/blob/master/examples/WireMock.Net.ConsoleApplication/packages.config#L4 I think there was a reason why I did not add this library to the `WireMock` and `WireMock.StandAlone` projects. I'll investigate further...
Author
Owner

@o7g8 commented on GitHub (May 18, 2018):

Unfortunately the explicit NuGet dependency (neither in projects consuming WireMock nor in WireMock itself) doesn't solve the issue. At least for my project which is net46.

@o7g8 commented on GitHub (May 18, 2018): Unfortunately the explicit NuGet dependency (neither in projects consuming WireMock nor in WireMock itself) doesn't solve the issue. At least for my project which is `net46`.
Author
Owner
@StefH commented on GitHub (May 19, 2018): I've added information to the WIKI: https://github.com/WireMock-Net/WireMock.Net/wiki/WireMock-as-a-standalone-process#workaround-for-microsoftowinhosthttplistener-exception
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#105