You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
.NET MAUI SQL Server doesn't work in release mode #2338
A clear and concise description of what the bug is.
I am using .NET MAUI. I connect to SQL Server using an IP address. I have a specific scenario that requires me to connect to SQL Server within my .NET MAUI application. It works fine in debug mode, and I can connect to SQL Server. However, I am unable to connect to it in release mode.
If you are seeing an exception, include the full exceptions details (message and stack trace).
Exception message:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 40 - Could not open a connection to SQL Server)
Stack trace:
### To reproduce
Create .NET MAUi App
Add Microsoft.Data.SqlClient
Add SqlConnection and enter your connection string using IP port,
Run the app on android in release mode
Partial code listings, or multiple fragments of code, will slow down our response or cause us to push the issue back to you to provide code to reproduce the issue.
### Expected behavior
A clear and concise description of what you expected to happen.
It should alow me to connect to SQL Server database as it is in Debug Mode.
### Further technical details
Microsoft.Data.SqlClient version: (found on the nuget or Microsoft.Data.SqlClient.dll)
.NET target: .NET8
SQL Server version: SQL Express 2022
Operating system: Window 11
**Additional context**
I am getting this in Event Viewer
The SQL Server Network Interface library could not register the Service Principal Name (SPN) [ MSSQLSvc/DESKTOP-TKH5FGS:1433 ] for the SQL Server service. Windows return code: 0xffffffff, state: 63. Failure to register a SPN might cause integrated authentication to use NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies and if the SPN has not been manually registered.
Can you you provide a packet capture that works for it, and one that it doesn't. For sanity check, can you check your app settings between release and debug to make sure there is no difference
Activity
kf-gonzalez commentedon Feb 6, 2024
Can you you provide a packet capture that works for it, and one that it doesn't. For sanity check, can you check your app settings between release and debug to make sure there is no difference
hammadkhandev888 commentedon Feb 7, 2024
Thank you for your comment. I have resolved the issue.
Here's what I did:
After these changes, it worked. I will now close the issue.