I am developing an Android App. When my App starts this error in below screen shot appears
I added a new rule on my server in the Azure portal to allow access for the client IP in error message, but I still have the same error. When I am Trying to execute sp_set_firewall_rule I have this:
I'm using a web service to connect my android App to microsoft SQL server database on Azure.
As #DavidMakogon said, please check the firewall of your Azure SQL Database whether allow access to Azure Service if your web service had been deployed on Azure, please see the figures below.
Fig 1. Browse the overview tab of your SQL Azure on portal
Fig 2. Enable the option for Allow access to Azure Service to ON
Then all of your web services on Azure can access the SQL Database.
Or if your web service had been deployed on other platform for accessing the SQL Database, you need to click Add client IP, then the Client IP address will be added to the firewall whitelist as the figure below.
Related
I have an Azure VM and a SQL DB on that VM - IAAS.
I want to get data from that DB using C#, but I'm unable to get how to connect to SQL of Azure VM using C#.
Any suggestions?
What would be the connection string I have to pass, and how can I get data from that SQL on Azure VM?
About connect to SQL Managed instance, it's located inside a Vnet.
The options to connect to it are :
From the Azure
Inside the same VNet (different subnet)
From different VNet using VNet peering / Site-to-Site VPN / Express
Route circuit (for cross-region connection)
From on-premises .
Using express Route or VPN
Then you can learn from this document:
Connect your application to Azure SQL Database managed instance:
You may choose to host application in the cloud either by using Azure App Service or some of Azure's virtual network (VNet) integrated options like Azure App Service Environment, Virtual Machine, Virtual Machine Scale Set. You could also take hybrid cloud approach and keep your applications on-premises.
Whatever choice you made, you can connect it to a Managed Instance.
After you configured these settings, you can reference Quickstart: Use .NET and C# in Visual Studio to connect to and query an Azure SQL database. This tutorial also include the Managed instance.
Hope this helps.
I have created a windows service to monitor receive location and send port events i.e. start/stop/enabled/disabled/enlisted/unenlisted for a local BizTalk server machine using a WMI ManagementScope class scope:
string strScope = #"\\.\root\MicrosoftBizTalkServer";
But when I try pointing at a remote machine/server to capture events using:
string strScope = string.Format(#"\\{0}\root\MicrosoftBizTalkServer", node.Address);
I receive an odd WMI error. The typical remote machine I am trying to point towards is a similar windows server with one small distinction that its BizTalk server is pointing to a SQL server located on yet another server within the network.
After a lot of googling and searching, I came across information pointing at a possible cause of failure being the classic "Double-hop" issue which occurs when we try to access remote BizTalk server when its SQL server is on another machine.
Within visual studio I was not getting enough information on the error that I tried a windows built-in tool "wbemtest.exe" to troubleshoot what was going on only to uncover a long error message such as this:
BizTalk Server cannot access SQL server. This could be due to one of the following reasons:
\n1. Access permissions have been denied to the current user. Either log on as a user that has been granted permissions to SQL and try again, or grant the current user permission to access SQL Server.
\n2. The SQL Server does not exist or an invalid database name has been specified. Check the name entered for the SQL Server and database to make sure they are correct as provided during SQL Server installation.
\n3. The SQL Server exists, but is not currently running. Use the Windows Service Control Manager or SQL Enterprise Manager to start SQL Server, and try again.
\n4. A SQL database file with the same name as the specified database already exists in the Microsoft SQL Server data folder.
\n
\nInternal error from OLEDB provider: \"Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.\""
I have tried playing with Firewall and DCOM setting under Administrative Services -> Component Services but no setting is working for me to pass on my user's credentials via "impersonation" and retrieve back receive location / send ports information.
Please share a workaround/solution/configuration settings that actually addresses this issue.
After a lot of research and thorough study, the solution was achieved via enabling / configuring Kerberos authentication for the non-domain admin. service account user and machines involved in communication i.e. client (machine sending WMI based request), Biztalk node (machine responding to the WMI based request) and SQL Server node (machine hosting / running SQL Server database engine service and most importantly Biztalk's databases which include messagebox, tracking, management and SSO).
This was all done under a single domain and delegation was setup for both the Biztalk node and SQL Server node along with the service account used.
DCOM permissions were granted to the service account for WMI and DTC(Distributed Transaction Coordinator) permissions were setup.
Appropriate SPNs were generated and appropriate SQL Server permissions were granted to the service account initiating WMI request in delegation mode.
Verified that Kerberos was enabled for the particular service account using the following SQL query:
select session_id,net_transport,client_net_address,auth_scheme from sys.dm_exec_connections
This is a double hop issue only, the problem you are facing is because you are trying to run a service and access remote server BizTalk server, which is then trying to logon to a remote SQL server. Your credential only reaches to BizTalk server but BizTalk server does not pass your credentials to another server.
Refer to this link for solution
Similar Issue
I just upload my project to Windows Azure website free version.
My website need to connect to external SQL server on another web hosting.(not SQL server on windows azure).
When i develop on my PC. Everything works well (that mean my connection string is correct).
But when i upload to windows azure. It can't connect to that database.
And throw exception like this.
Access is denied
when i do the following this answer, error show like this
Connecting to remote SQL Server 2008 from Windows Azure
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
and both show stack trace like this
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
[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.
how can i solve this issue, please help.
You're uploading your application to a Windows Azure Website. Most probably port 1433 that connects to SQL Server is blocked by default on their firewall. Since you're using an azure website you will have no control over this firewall setting.
You can either:
Migrate your existing SQL Server database into SQL Azure and consume it from there
Upgrade your application to a Cloud Service where you can define the endpoints you need to connect to the external database (which I wouldn't recommend anyway because it would be very slow on deployment)
Find a way to publish your existing database as web services so you can consume them from your application, but you would probably have to rewrite your app's data access layer.
I would simply move everything to SQL Azure, it's pretty straightforward.
If you can add a website to the remote host where the database is hosted, can you create a service (e.g. WCF or Rest) on that same host that allows you to talk to the database? That way you can still host the database on the external host and communicate with it via the service from the Azure Website.
Looks like there's a new way to allow Azure webapps to connect to on premises SQL Servers using Hybrid Connections. Google leads me to believe that this feature became available sometime in 2016. It will require that you install additional software on the machine that hosts your SQL Server instance.
More information available here.
I have a simple question, I was granted to a SQL Server database using windows authentication on my local machine, I need to know how to use this access on hosting server as well.
For example I am in the middle of writing some C# code that pulls data from this database, I can run this code on my local machine with my windows authentication no problem, but I can't run it on expected hosting server because that server obviously can't connect to that database.
I was just wondering how can I use windows authentication access remotely?
Thanks
Windows authentication must be enabled on the remote server to do this. This can be enabled in server properties > Security and by selecting SQL Sever and Windows Aucthentication radio button. Providing your windows credentials are added to the server then you should be able to login.
On your SSMS right click the database name select properties and select Security from the left hand menu and there you should see the "SQL Sever and Windows Aucthentication" option.
Obviously if your database is not on the same domain then this might not work.
I am hosting web service in a one machine using Visual studio 2008. I tried accessing the web service from a web site i created in the same solution and it was successfully called. Now i want to access the web service from a remote client.
I initially developed the web service to used in an android application. As you can see if I wan to access the web service I will have to host is with a static IP. So at least to test the application i want access the web service from the android mobile by connecting both server and android mobile to one wifi network. For the initial test I connected two laptops(one is server) to the wifi router. And i pingd the server from the client machine and it got successfully pingd. But when i try to access the web service with given port from the browser it wont allow me to connect. I tried http://localhost:26796/ by replacing the localhost with ip of the server and also i tried making a small web site(asp) and try to access it from the client via IP. Both did not work. I have searched here and on web could not find a proper answer. for,
how to host a webservice so other clients in the same network can access..?
can it be fulfilled with VSD server..?
is it compulsory to use iis..?
How should i achieve this..?
NOTE: Moved from comments to answer as per user suggestion.
Publish the web service to your local machine's IIS as an Application. Then you can access the site from anywhere in your network. Running it directly from VS means it's hosted inside VS's ASP.NET Development Server (which, by default is only accessible locally). You can try opening up the port specified in the ASP.NET development server that starts up on your machine's local firewall, then you can access the debug instance being hosted