An error occurred while processing your request. ASP.NET Core 5.0 - asp.net-core

Please help me solve this issue once I am trying to deploy my website on Azure while my ASP_ENVIRONMENT set to Production still getting this issue. Please help me solve my deployment on Azure step by step

HDLCAMPUS6275\\SQLEXPRESS is on-premise sql server, that's why you get this issue.
If you have the public ip, you could change the connectionstring like blow.
Data Source=public_ip,1433;Initial Catalog=FoodHub;Persist Security Info=True;User ID=sa;Password=Anunay#123;encrypt=true;TrustServerCertificate=True;Max Pool Size=100
You should test it in your local by using the sql server management studio(SSMS).
Related docs:
1. How to configure SQL Express 2012 to accept remote connections
2. Generate or find Connection String from Visual Studio
3. If you don't have public ip, you could use ngrok for test
Then your should be fixed.

Related

Azure App Services cannot connect to Azure SQL Database

I have an API published to Azure App Services, using ef core, connect to Azure SQL database. below are the steps and the problem:
The Azure SQL database is up and running OK, I setup two firewall rules, one for my local dev ip, one for Azure App. I can connect to Azure SQL from local without any issue, and I have done the migrations.
I copied the connection string from Azure SQL and put in the appsettings.json, running the API from my local and connect to Azure SQL without any issue.
I published my API to Azure App services without any issues, I can see my app running OK since it has static file.
Then I went to Azure App Services => Settings/Configuration => Connection strings, create one new connect string with the same key/value as I used in the appsettings.json, based on the document from Microsoft: https://learn.microsoft.com/en-us/azure/app-service/containers/configure-language-dotnetcore#access-environment-variables
But the problem is after I done these, my API still not working, the api call to SQL return error 500.
Anything I missed or did wrong?
Thanks!
Thanks for the comments CSharpRocks, I did by adding the client ip, but I figured that's not the right way, so resolved by set the "Allow Azure services and resources to access this server" to True, that works.
For Others looking for the answer I had followed the steps above and it still did not work for me. But when I went to Visual Studios --> Publish --> Service Dependency's --> Add Azure SQL Database That fixed it for me.

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Azure Active Directory is only supported on Windows operating systems

We are trying to run sql files from Jenkins Linux machine using Liquibase to the Microsoft SQL server db and getting the error as:
ERROR: Build step failed with exception java.lang.RuntimeException:
Error getting database connection using driver
com.microsoft.sqlserver.jdbc.SQLServerDriver using url
jdbc:sqlserver://*********.database.windows.net:***;database=*********;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;Authentication=ActiveDirectoryIntegrated'
at org.jenkinsci.plugins.liquibase.evaluator.AbstractLiquibaseBuilder.createJdbcConnection(AbstractLiquibaseBuilder.java:236)
at org.jenkinsci.plugins.liquibase.evaluator.AbstractLiquibaseBuilder.createLiquibase(AbstractLiquibaseBuilder.java:164)
at org.jenkinsci.plugins.liquibase.evaluator.AbstractLiquibaseBuilder.perform(AbstractLiquibaseBuilder.java:129)at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)at hudson.model.Build$BuildExecution.build(Build.java:205)at hudson.model.Build$BuildExecution.doRun(Build.java:162)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1720)at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)at hudson.model.ResourceController.execute(ResourceController.java:98)at hudson.model.Executor.run(Executor.java:404)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: **Azure
Active Directory is only supported on Windows operating
systems.**at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1289)at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:773)
We have tried connecting directly with SQL server authentication and it was successful but while using Azure service principal credential we are getting this error. How do we use Azure SPN to work with Liquibase?
Are you sure you want to connect using active directory integrated to SQL Azure? You should try to connect using the admin server login of SQL Azure or using a login created on SQL Azure. If that is the case, please look how to create the connection string on the samples contained on below article.
https://learn.microsoft.com/en-us/azure/sql-database/sql-database-connect-query-java
Hope this helps.
Regards,
Alberto Morillo

Azure Cloud Service + SQL Azure and firewall configuration issue

I'm facing the issue while creating a azure database in the local machine by sql server 2012 ,
this is my error:
TITLE: Connect to Server
Cannot connect to tcp:ServerName.database.windows.net.
ADDITIONAL INFORMATION:
Login failed for user 'UserName'.
This session has been assigned a tracing ID of '041a1130-65a5-4ad6-91c0-02ff3b4fbca5'. Provide this tracing ID to customer support when you need assistance. (Microsoft SQL Server, Error: 18456)
The issue is occurring might be due to following the following, I have specified how to overcome against each issue:
Check if your IP is added in the firewall, if not refer to http://msdn.microsoft.com/en-us/library/azure/jj553530.aspx
Check if you have configured the wrong IP in Azure Firewall. Try opening SQL Azure Management Studio online http://msdn.microsoft.com/en-us/library/azure/ee621784.aspx#WinAzMgtPort where it asks you to add the IP in firewall.
If above is not working then check if the user credentials is correct, if you forgot the credentials then resetting it might help.

SQL Server 2008 - Reporting Services Failed Login for User '...'

Good Afternoon,
I'm having difficulty running a report with a data source saved on the Report Server using credentials for a user I created on SQL Server named 'ReportUser'. Attempting to resolve this I've mapped the user to the 'ReportServer' database with the db_owner role as well as setting the default database to the 'ReportServer'. However, each time I attempt to run the report I receive the error message:
Cannot create a connection to data source 'Test'. Login failed for user 'ReportUser'.
I'm running SQL Server 2008 from my local machine and am able to successfully run the reports when I setup the datasource using Windows Authentication. Any idea on what could be causing the issues when attempting to use the SQL Authentication with the 'ReportUser'
Thank you very much for your help!
Thank you for your reply.
I believe I found the cause of my issue. Since this was a local install for testing purposes I just set up the instance of SQL Server with Windows Authentication. However, I made the mistake of not setting up the server for both Windows and SQL Authentication. The following link helped me resolve this.
http://forums.asp.net/t/1784261.aspx/1?Could+not+connect+to+database+login+failed+for+user+sa
After changing this setting and restarting the SQL Server everything appears to be running properly now.

SQL XML Bulk Loader - Error connecting

I'm using the sqlxmlbulkloadlib to perform an xml bulk load. When integrated security=SSPI, the process completes fine inside a workflow hosted on my local machine in a wcf service. However, when that workflow is hosted on our server and kicked off from a service reference on an aspx page, the bulkloader produces an error connecting to the data source. I have tried using sql server authentication instead, but that fails even on my local machine with the same error connecting to data source.
My connection string looks like:
"provider=SQLOLEDB;data source=Myserver;database=Mydb;User ID=Myuser;Password=Mypassword"
Ok, so after creating the sql account for the bulkloader, the policy required that I change the password. Didn't catch that till I tried logging in with the account in management studio.
I am curious, though, what I would have to do differently for integrated security to work from the production server.