wiremock / wiremock/WireMock.Net

Urls in settings require a port

Open
#1,477 11 comments 0 reactions 1 assignee View on GitHub

@DavidJohnWilliams is already working on this.

Since Jun 22, 2026.

bug
Dominant language
C#
Stars
1.7k
Forks
240
Avg merge
5d 12h
Merged PRs (30d)
2

Description

Describe the bug

If you use the Urls setting and don't supply a port, when starting under ASP.Net Core you receive a timeout error.

The actual error is a NRE from this line: https://github.com/wiremock/WireMock.Net/blob/cbc28c235c711a47dad5d628b3172e159968159d/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.cs#L152

PortUtils.TryExtract has null annotations to say that the scheme out parameter will be null if TryExtract returns false, but there is a null-forgiving operator on the next line so you get a NRE.

Expected behavior:

Either no port is allowed and the code above should not run if TryExtract returns false; or the docs should be updated to explain that port is required on entries in Urls.

Test to reproduce
  • 1 - Add a url to Urls without a port
  • 2 - Start the server
Other related info

Side note: The exception thrown from Start is a timeout rather than the actual exception that occurred which made debugging the issue more difficult. It would be good to solve that as well.

BTW, I am happy to create a PR for this, but I'm raising the issue first for discussion.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.