I have created a sample ASP.NET MVC app (the standard one you get in Visual Studio). I have deployed this to Azure and it works fine. I have SQL Server 2016 running locally (on premise) on my machine and the cloud app uses this database. I have created a hybrid connection and everything is connected as it should be. But when I run the app its not connecting to the database for some reason. The connection string works fine locally:
<add name="DefaultConnection" connectionString="Server=MyPC-QQ5, 1433;Initial Catalog=myDataBase;User Id=sa;Password=thePassword!;" providerName="System.Data.SqlClient" />
Is anyone else experiencing this problem.
Related
I created a blazor server web app in Visual Studio 2022 from template that uses a default localdb database for MS identity/authentication. I deployed the app to Azure app service and it works great even with the localdb. How does that work? Does it work because it's blazor server and it just creates the localdb on whatever server it lands on? Obviously, I can get at the identity database through code, but there's no way to do SQL queries in the portal because the localdb database is "ephemeral". Can anyone help me understand how this works?
Relatively new to azure cloud so go easy
Configuration as below on
1 x app service (running asp.net web application)
1 x azure database for mysql server
(so currently 2 resources)
Now whenever i put my connection string into my web app to point to the mysql database hosted on azure, it just times out, with the error below
[MySqlException: Unable to connect to any of the specified MySQL hosts.]
I have set the security to allow access to azure services as per documentation, and disabled the enforce SSL for now. I am able to connect to the database remotely from my machine, but my web app times out.
I have tried every permutation of connection string but it makes no difference. It works if i use the mysql in app but this is not a scalable solution for us.
Did you copy your connection string from Azure and plug it into your web config under the connectionstrings node? If so, did you remove the connectionstring name then re-add it? Such as:
<connectionStrings>
<remove name="conn" />
<add name="conn" connectionString="Server=localhost\SQLEXPRESS;Database=***;Trusted_Connection=True;" providerName="System.Data.SqlClient" />
This is the best practice for using a connectionstring in a webconfig file.
As well take a look at your error details. You are trying to use environment variables for connecting to the database. This won't work because you are in two different environments: the first being your web app environment and the second being the database environment.
Even if you are using Azure as a host, it still won't work.
I am deploying an Web app to Azure using Visual Studio 2017.
The web app is using windows authentication & gets deployed without any error but gets redirected to https://localhost:44334/
As I am using Windows authentication it correctly uses my azure credentials to log me in and redirects to the localhost.
In the web config I changed the key for ida:PostLogoutRedirectUri to the Azure app service url.
It works fine on localhost but when I changed the webconfig url it still redirects the page to https:/localhost:4434 and gives an error Error Code: INET_E_RESOURCE_NOT_FOUND
<appSettings>
<add key="ida:ClientId" value="265751ce-5142-4d79-ba57-86ab32293f9e" />
<add key="ida:AADInstance" value="https://login.microsoftonline.com/" />
<add key="ida:Domain" value="myaccount.onmicrosoft.com" />
<add key="ida:TenantId" value="09bacfbd-47ef-4465-9265-3546f2eaf6bc" />
<add key="ida:PostLogoutRedirectUri" value="https://myportal.azurewebsites.net/" />
I followed this link https://learn.microsoft.com/en-us/aspnet/core/tutorials/publish-to-azure-webapp-using-vs?view=aspnetcore-2.2
Is there a web config or setting that I am missing.
1.If you want to publish you web app to azure and use azure credentials to login in , you should not choose Windows authentication, this authentication verify you local windows's account. I suggest you using Work or School Accounts. Then create App registration and set the web.config.
2.As for the problem you occurred ,it didn't occur to me. Because if you publish the web app with Windows authentication, even you set the web.config the app won't open the authentication window. And if you run it on local and it redirects to localhost, this is completely OK.
I suggest you using Work or School Accounts and deploying it, if you still have questions, please let me know.
Has anyone ever connected ASP (ASP, aka classic not .NET) to an Azure db? I've had three experts looks at connection strings, endpoints, firewalls, db accounts and they're finding
the database works and contains data
the database is accessible remotely by our local machines via Visual Studio and SQL Server Manager
ASP runs on web server on the VM machine
All the connection strings offered by Azure fail
All db related ports are open
If you're connecting to the Azure DB from SSMS, everything is probably configured properly.
Which client library are you using to connect to the Azure SQL instance? You may need to download and install the MS SQL Native Client on the VM, which I know works.
Are you using ADO in your app? If so, and assuming you have installed the Native Client, this connection string will work:
Driver={SQL Server Native Client 10.0};Server=tcp:[serverName].database.windows.net; Database=myDataBase;Uid=[LoginForDb]#[serverName];Pwd=myPassword;Encrypt=yes;
I am running the platform ready test tool to try and qualify for the Powered By Windows Azure Logo Program.
My application is in production and has been running in azure for 5 months now. The application consists of a windows forms and WPF Client application which connects to a set of WCF Services running in azure which in turn connects to SQL Azure. The application also uses blob storage in Azure and I have getting on for 1TB of documents up there.
The application uses basic http binding and is configured Like this
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName" />
</security>
I successfully passed the test for SQL Azure but failed the test for windows azure with the following message
======================================================================
Test case/Verification: TC 1 -
Application must be a valid Azure
application designed to connect with
or work in the Windows Azure Environment
======================================================================
Status is ProtocolError
Fail
The only thing I can think of this is causing this is that the application connects over https and the test tool does not allow me to specify a https endpoint. However I don’t think I can easily expose a plain http endpoint just to pass the test as WCF wont allow me to do that when TransportWithMessageCredential is used.
Does anyone have any ideas?
Our service AzureWatch is in the same boat. I've been in touch with MS engineers at the Ready program and they don't appear to support our precise scenario. However, they do have a version of the tool that can use https channel. I suggest contacting them via support channel. They may supply you with a later version to try, and if that fails with forms to request "bypass" of the actual testing
HTH