microsoft / DockerTools

Tools For Docker, including Visual Studio Provisioning and Publishing
Other
175 stars 26 forks source link

Problem with API developed in Visual Studio 2022 Net Core 6 with Docker compatibility: Works in Debug but fails in Release #393

Closed rlivon closed 2 months ago

rlivon commented 1 year ago

I developed an API in Visual Studio 2022 for Net Core 6 with Docker compatibility: And it has problems creating a session and connecting to an MSQL 2019 engine if I run it in Release mode. In Debug, everything works perfectly. In this git repository is the code:

https://github.com/rlivon/paas-sisttransfermep-combcra-misc

In this same git repository you can see a video: APINetCore6DockerVS2020.mp4 (in Spanish) of how the API behaves whether it is executed locally, where it works, creates the session and connects to the database, both in Debug mode and in Release mode. You can also see how it runs correctly when triggered with Docker and works fine in Debug mode. However, when doing it in Release mode, you cannot create the session and therefore connect to the MSQL Server engine.

I hope you can help me.

Thank you so much.

bwateratmsft commented 1 year ago

This looks to be about the VS containers extension, not the VSCode one, so I'll transfer the issue over to that repository.

dbreshears commented 1 year ago

@rlivon, I suspect this is related to the application settings / configuration in the release configuration that isn't getting set correctly in the container, where it is in debug config. I would recommend getting a terminal from the container tools window into the container and examining the environment settings and comparing how the connection string is getting set between debug and release. This error is typically related to an issue with the connection string or the SQL query. You might also set a breakpoint and turn on first chance exceptions and see if there is additional information in the inner exception details at the point of failure.

dbreshears commented 2 months ago

Closing stale issue