WireMock Setting 'SaveMappingToFile' raising cast object to type error #322

Closed
opened 2025-12-29 15:20:46 +01:00 by adam · 3 comments
Owner

Originally created by @jmontalto01 on GitHub (Dec 21, 2020).

Describe the bug

I am using wiremock docker compose example with ProxyAndRecordSettings (command "--ProxyURL" ) and setting "--SaveMappingToFile", "true". It raises the following error when browsing to http://localhost:9091/__admin/mappings

{"Status":"Unable to cast object of type 'WireMock.ResponseProviders.DynamicResponseProvider' to type 'WireMock.ResponseBuilders.Response'."}

Expected behavior:

Load mapping files

Test to reproduce

Docker Compose file:

version: "3.8"

services:
wiremock:
image: sheyenrath/wiremock.net
ports:
- "9091:80"
volumes:
- ./wiremock/mappings:/app/__admin/mappings
command: ["dotnet", "wiremock-net.dll", "--Urls", "http://*:80", "--ReadStaticMappings", "true", "--AllowPartialMapping", "true", "--WireMockLogger", "WireMockConsoleLogger", "--ProxyURL", "https://api.hub24.com.au/epi/epiportfolio.asmx", "--SaveMapping", "true", "--SaveMappingToFile", "true"]

Provide additional information if any.

Originally created by @jmontalto01 on GitHub (Dec 21, 2020). ### Describe the bug I am using wiremock docker compose example with ProxyAndRecordSettings (command "--ProxyURL" ) and setting "--SaveMappingToFile", "true". It raises the following error when browsing to http://localhost:9091/__admin/mappings {"Status":"Unable to cast object of type 'WireMock.ResponseProviders.DynamicResponseProvider' to type 'WireMock.ResponseBuilders.Response'."} ### Expected behavior: Load mapping files ### Test to reproduce Docker Compose file: version: "3.8" services: wiremock: image: sheyenrath/wiremock.net ports: - "9091:80" volumes: - ./wiremock/mappings:/app/__admin/mappings command: ["dotnet", "wiremock-net.dll", "--Urls", "http://*:80", "--ReadStaticMappings", "true", "--AllowPartialMapping", "true", "--WireMockLogger", "WireMockConsoleLogger", "--ProxyURL", "https://api.hub24.com.au/epi/epiportfolio.asmx", "--SaveMapping", "true", "--SaveMappingToFile", "true"] ### Other related info Provide additional information if any.
adam added the bug label 2025-12-29 15:20:46 +01:00
adam closed this issue 2025-12-29 15:20:46 +01:00
Author
Owner

@StefH commented on GitHub (Dec 21, 2020):

@jmontalto01 Can you provide your (static) mapping json file(s)?

@StefH commented on GitHub (Dec 21, 2020): @jmontalto01 Can you provide your (static) mapping json file(s)?
Author
Owner

@jmontalto01 commented on GitHub (Dec 22, 2020):

Hi,
There was no static mapping files. Folder was empty so I would expect an empty list to return when browsing to http://localhost:9091/__admin/mappings. At the time the error is raised it does then create a mapping json file on my drive which I have supplied below together with the wiremock log which gives more details of the error.

Wiremock Log:
wiremock log.txt

mapping file at the time of error returned in browser:
2a1dd2a5-46dc-42a0-91a7-2f94797db1a2.txt

@jmontalto01 commented on GitHub (Dec 22, 2020): Hi, There was no static mapping files. Folder was empty so I would expect an empty list to return when browsing to http://localhost:9091/__admin/mappings. At the time the error is raised it does then create a mapping json file on my drive which I have supplied below together with the wiremock log which gives more details of the error. Wiremock Log: [wiremock log.txt](https://github.com/WireMock-Net/WireMock.Net/files/5727053/wiremock.log.txt) mapping file at the time of error returned in browser: [2a1dd2a5-46dc-42a0-91a7-2f94797db1a2.txt](https://github.com/WireMock-Net/WireMock.Net/files/5727057/2a1dd2a5-46dc-42a0-91a7-2f94797db1a2.txt)
Author
Owner

@StefH commented on GitHub (Dec 23, 2020):

@jmontalto01 I think I found the issue, a new version from the NuGet + Docker will be released shortly.

This will be version 1.3.10

I'll close this now, in case it is not solved. just comment to this issue.

@StefH commented on GitHub (Dec 23, 2020): @jmontalto01 I think I found the issue, a new version from the NuGet + Docker will be released shortly. This will be version 1.3.10 I'll close this now, in case it is not solved. just comment to this issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#322