Deploying ASP.NET Core Web API to Azure - with Azure Key Vault and SQL Database dependency - deployment

I was able to deploy my Web API to Azure. I had to configure for 'Azure Key Vault', 'Azure SQL DB' and 'Microsoft Identity platform' before deployment as they were dependencies.
I configured Azure Key Vault and while configuring for SQL database, I selected the option to save connection string value in 'Azure Key Vault' instead of 'Azure app settings' (please see screenshot below).
When i press configure for 'Microsoft identify platform', the page shows loading symbol but never finshes and doesnt show any tenant id or details for configuration. Please see screenshot below.
So I had to ignore configuring Microsoft Identity Platform for now.
I was able to deploy the app to Azure, but when I try accessing the Azure endpoint, I get an error
HTTP ERROR 500 (Trouble retrieving data from database).
Log file message below while accessing the Azure endpoint:
An error occurred using the connection to database 'databasename' on server 'servername'.
An exception occurred while iterating over the results of a query for context type 'ItemApp.Infrastructure.Repository.ItemDBContext'.
Microsoft.Data.SqlClient.SqlException (0x80131904):
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...
Can anyone point where I am going wrong? Thanks in advance.

Check to see if your database engine can handle remote connections:
Start > All Programs > SQL Server 2005 > Configuration Tools > SQL
Server Surface Area Configuration
Click on Surface Area Configuration for Services and Connections
Select the instance that is having a problem > Database Engine >
Remote Connections
Enable local and remote connections
Restart instance
Check if your SQL server services is up and running properly:
Go to All Programs > Microsoft SQL Server 2008 > Configuration Tools > SQL
Server Configuration Manager > SQL Server Services
Check to make sure SQL Server service status is Running.
In addition, ensure that your remote server is in the same network.
Run sqlcmd -L to ascertain if your server is included in your network list.
You may need to create an exception on the firewall for the SQL Server instance and port you are using:
Start > Run > Firewall.cpl
Click on exceptions tab
Add sqlservr.exe (typically located in C:\Program Files
(x86)\Microsoft SQL Server\MSSQL.x\MSSQL\Bin, check your installs for
the actual folder path) and port (default is 1433)
Check your connection string as well
Please check the MSFT Document to troubleshoot the error: Here.

Related

How do I identify the Initial Catalog(name of the collection database) in a migrating step of Azure DevOps Server to Services?

I am an administrator of Azure DevOps Server 2019 Update 1.1 in an organization.
I will migrate our collection from the on-premises server to Azure DevOps Services.
Currently, I am on the step of using SqlPackage.exe to generate a DACPAC file.
https://learn.microsoft.com/en-us/azure/devops/migrate/migration-import?view=azure-devops
According to this reference, the command example to generate DACPAC is as below.
SqlPackage.exe /sourceconnectionstring:"Data Source=localhost;Initial Catalog=Foo;Integrated Security=True" /targetFile:C:\DACPAC\Foo.dacpac /action:extract /p:ExtractAllTableData=true /p:IgnoreUserLoginMappings=true /p:IgnorePermissions=true /p:Storage=Memory
However, I cannot understand what is Initial Catalog.
The reference said Initial Catalog - Name of the collection database.
But I could not find the name of the collection database in Azure DevOps Server management console.
I referred another article on dev.to
https://dev.to/timothymcgrath/the-great-azure-devops-migration-part-6-import-2obc
By this article, Initial Catalog=[COLLECTION_NAME],
and the collection name in my Azure DevOps Server is "DefaultCollection" (default name).
Then, I tried the following command then failed.
C:\Program Files (x86)\Microsoft Visual Studio\2017\SQL\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130> ./SqlPackage.exe /sourceconnectionstring:”Data Source=localhost;Initial Catalog=DefaultCollection;Integrated Security=True” /targetFile:C:\DefaultCollection.dacpac /action:extract /p:ExtractAllTableData=true /p:IgnoreUserLoginMappings=true /p:IgnorePermissions=true /p:Storage=Memory
Connecting to database 'DefaultCollection' on server 'localhost'.
Extracting schema
Extracting schema from database
*** Error extracting database:Could not connect to database server.
(provider: Named Pipes Provider, error: 40
Is this error caused by wrong Initial Catalog?
How do I find the correct Initial Catalog - Name of the collection database?
Environment and pre-conditions
Windows 10 Pro
SqlPackage.exe installed from SSDT for Visual Studio 2017
The machine where commands are executed and where Azure DevOps Server running is the same
so, DataSource=localhost should be correct, I think
Detached my collection by Azure DevOps Server management console
SQL Server Express for my Azure DevOps server is running
Look at the admin console on your app tier. That shows you all of the databases.
For what it's worth, the standard name for the default collection database is Tfs_DefaultCollection. It may be different in your case, but that's a safe bet.
Resolved.
The database name in the case is "AzureDevOps_DefaultCollection".
It could be found by Azure DevOps Management Console in the feature of selecting attach. (Application Tier -> Team Project Collections)
Or, by using SQL Server Management Studio, we can also find "AzureDevOps_DefaultCollection".
And, in my case, DataSource=localhost is wrong, DataSource=<hostname>\SQLEXPRESS is correct.
I noticed this answer when I connect to my database by SQL Server Management Studio.
Finally, I successfully generated a DACPAC file.
Connecting to database 'AzureDevOps_DefaultCollection' on server '<my machine host name>\SQLEXPRESS'.
Extracting schema
Extracting schema from database
Resolving references in schema model
Validating schema model for data package
Validating schema
Exporting data from database
Exporting data
Processing Export.
Processing Table '[dbo].[tbl_PropertyValue]'.
Processing Table '[Task].[tbl_LibraryItemString]'.
...
...
...
Processing Table '[Search].[tbl_FileMetadataStore]'.
Processing Table '[dbo].[SequenceIds]'.
Successfully extracted database and saved it to file 'C:\DACPAC\DefaultCollection.dacpac'.
Thanks so much! Mario Dietner, Daniel Mann.

A connection cannot be made. Ensure that the server is running

When I am trying to process dimensions after creating a data source view I get the error:
The project could not be deployed to the server because of the following connectivity problems : A connection cannot be made. Ensure that the server is running. To verify or update the name of the target server, right-click on the project in Solution Explorer, select Project Properties,click on the Deployment tab, and then enter the name of the server.
I have checked in task manager & SQLBrowser is running. Why am I getting this error?
I was able to get the SQL Server instances on my computer this way:
Start Menu
Microsoft SQL Server 2008 or your version
Server Installation Center
Admin login
Select "Tools" from left menu
Select "Installed SQL Server features discovery report"
You then get a nice HTML web page. You want to look for Database Services. You should see an instance name. Mine is called "SQLEXPRESS." So the combination of server name and instance would be MYCOMPUTER\SQLEXPRESS given that my computer name is MYCOMPUTER.
BTW, the default instance name is MSSQLSERVER.
Alternatively, you can get it from your registry. Just run regedit and look for this key: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL
Check that the SQL Server service itself (or MSSQLSERVER) is running. Also check the connection string.
If you want to deploy the project to a named instance of Analysis Services on the local computer, or to an instance on a remote server, change the Server property to the appropriate instance name, such as <InstanceName>.
https://learn.microsoft.com/en-us/analysis-services/multidimensional-tutorial/lesson-2-5-deploying-an-analysis-services-project?view=asallproducts-allversions
You need the server name and the instance name.
Open port 2382,2383 to server solve this issue for me.

Visual Studio cannot process a dimension

I'm trying to create a cube using SQL Server 2008 R2. When I tried to process a dimension, this error occurred:
The project could not be deployed to the 'wasim-PC/Joker' server
because of the following connectivity problems : A connection cannot
be made. Ensure that the server is running. To verify or update the
name of the target server, right-click on the project in Solution
Explorer, select Project Properties, click on the Deployment tab, and
then enter the name of the server.
I searched about a solution but I failed.
When you process a cube or dimension, its definition is first deployed to a server running SQL Server Analysis Services.
The error tells you that the deployment fails because it cannot find the service on 'wasim-PC/Joker'. I'm guessing this is your workstation. Make sure they analysis services service is installed and running on your local system. If you want to deploy to a different server, follow the steps specified in the error message.
I changed UAC Setting to "Never notify me" and every thing work well now! ( Windows 7 )

SQL Server Compact ADO.NET Data Provider: Access to the database file is not allowed

I am accessing a SQL Server CE file dbLogs.sdf stored on a shared location (with full right to "Everyone") through a C# assembly under a Windows service.
When I debug the service in Visual Studio 2008, it is accessing the .SDF file without any issue but when I actually run the Windows service it throws exception when I try to open the connection. The full detail of the error is as below:
Error Message: Access to the database file is not allowed. [ File
name = \192.168.17.228\shared\dbLogs.sdf]
Source: SQL Server Compact ADO.NET Data Provider
StackTrace: at System.Data.SqlServerCe.SqlCeConnection.ProcessResults(Int32
hr) at
System.Data.SqlServerCe.SqlCeConnection.Open(Boolean
silent) at
System.Data.SqlServerCe.SqlCeConnection.Open()
at LogStat.GetLogDetails(String
logType) at LogStat.ProcessLogStats()
I have tried the identity impersonate with username and password authentication in system.web section under app.config but it didn't work.
But when I copied the same code in a console application and it worked without any issue.
Do I need to provide authentication in window service in some other way?
Thanks in advance :)
You need to run the Windows Servcie under an account, that has access to the share.

SQL Server Linked Server error

I am using SQL Server 2008 on Windows Server 2003. I want to use a linked server to open a Visual Foxpro DBF file, using driver Microsoft OLD DB Provider for Visual Foxpro from SQL Server 2008 linked server feature.
When I establish linked server connection by using Microsoft OLD DB Provider for Visual Foxpro, to open a Foxpro DBF file, I meet with the following error, any ideas what is wrong?
Can not retrieve required data from this request (Microsoft.SqlServer.Management.Sdk.Src)
Meeting exception when executing Transact-SQL or batch (Microsoft.SqlServer.ConnectionInfo)
Error from Microsoft OLD DB Provider interface "VFPOLEDB" of linked server "DBFServer", access is defined.
Can not retrieved required interface "IID_IDBSchemaRowset" from OLE DB interface "VFPOLEDB" of linked server "DBFServer"
(Microsoft SQL Server error 7399)
regards,
George
Check 'Allow Inprocess' on the VFPOLEDB provider:
See Cindy Winegarden's answer on http://social.msdn.microsoft.com/forums/en-US/sqlreportingservices/thread/e54d20dd-b65b-4cff-9349-6499e6e069e2 for how to do it.
Edit: this is the relevant part of the answer:
Here's what Stepahnie posted to her thread in the
microsoft.public.data.oledb NNTP newsgroup on April 10:
"Finally, I found an option ' Allow inprocess' in linked server ->
providers -> VFPOLEDB in MSSQL2005. With enable this option, I can
connect to vfp with oledb. While diabling this option, it works only
50% with successful connection....
And I have another MSSQL2005 with the same setup (except the option
'allow inprocess' disabled), all the connection make to vfp is 100%
successful... "
I looked and found that, as she said, in Server Objects > Linked
Servers > Providers > VFPOLEDB > General tab > Provider options >
Allow inprocess. Also, you can change the InProcess setting with the
following code:
USE [master]
GO
EXEC master.dbo.sp_MSset_oledb_prop N'VFPOLEDB', N'AllowInProcess', 1
GO