Forms-Based Authentication with SQL Azure - azure

I tried to implement the SqlMembershipProvider to connect to a database in Azure. I followed this tutorial (Forms-Based Authentication with SQL Azure). But there is a part, when it says replace the following line in your web.config file:
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
The problem that I cannot find it in my web.config (I use Visual Studio 2012 and started a Windows Azure Cloud Service with ASP.NET Web Role)
I did not manage to find under what tag should I put the given code line. Can someone help me out?

Related

Access to Azure SQL database returns unsupported keyword “metadata” error

I have an Azure Web App that accesses my Azure SQL Server database. Until recently (August 2020) the access worked without a problem but now it is not working. When I develop and test the app locally on my machine the read/write to the Azure SQL database is working, just not when I deploy the app to Azure.
I added the Web App’s outbound IP range to the Azure SQL Server firewall settings with no success.
I am using Entity Framework to connect to the database and want to continue doing so.
The error I get is:
"Keyword not supported: 'metadata'."
at System.Data.Common.DbConnectionOptions.ParseInternal
"The underlying provider failed on ConnectionString."
at System.Data.Entity.Core.EntityClient.EntityConnection.ChangeConnectionString
The test that it’s working would be to visit https://www.triviaweb.net/ and see a list of players in the scoreboard.
That connection string is only supported by Entity Framework. Use the below connection string and it should work. If it doesn't then try taking off ;application name=EntityFramework from the connection string.
<add name="Entities" connectionString="data source=tcp:dolaris.database.windows.net;initial catalog={dbname};persist security info=True;user id={user};password={psw};multipleactiveresultsets=True;application name=EntityFramework" providerName="System.Data.EntityClient" />

Disable RapidFail Protection in WebApp

I have recently migrated from Azure Cloud Service to Azure Web App. Earlier I use to Disable the rapidFailProtection from my Webrole class. After the migration to Web App, I have remove the webrole class and added the code of rapidFail in the Application startup routine of the global.asax file. But it gave an error:
role discovery data is unavailable
at the following line:
Dim mainSite = serverManager.Sites(RoleEnvironment.CurrentRoleInstance.Id + "_Web")
How can I achieve the same functionality for my Azure Web App?
How can I achieve the same functionality for my Azure Web App?
As far as I know, the rapidFailProtection is a application pool setting which you could set it in the ApplicationHost.config file in app service.
So if you want to set the rapidFailProtection to false in the azure web app, I suggest you could try to use XML Document Transformation (XDT) declarations to transform the ApplicationHost.config file in your web app in Azure App Service.
I suggest you could try below steps to add the XDT file to your web app to change the ApplicationHost.config settings.
1.Access the KUDU console.Find the Advanced Tools in DEVELOPMENT TOOLS click go.
2.Click dubug console's cmd.
3.Locate the D:\home\site and add below xdt file.
Notice: Change the name as your web app service name
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.applicationHost>
<applicationPools>
<add name="testforapppool" xdt:Locator="Match(name)">
<failure rapidFailProtection="false" xdt:Transform="InsertBefore(/configuration/system.applicationHost/applicationPools/add[(#name='testforapppool')]/*[1])" />
</add>
<add name="~1testforapppool" xdt:Locator="Match(name)">
<failure rapidFailProtection="false" xdt:Transform="InsertBefore(/configuration/system.applicationHost/applicationPools/add[(#name='~1testforapppool')]/*[1])" />
</add>
</applicationPools>
</system.applicationHost>
</configuration>
Image:
Besides, you could also install Site Extension called IIS Manager which lets you very easily create XDT files simply by editing your applicationhost.config.
More details, you could refer to this article:
Azure App Service web app advanced config and extensions
Xdt transform samples

How do I install Umbraco on Azure by using SQL Azure database as backend?

I have successfully installed Umbraco on an App Service in Azure by using the following approach:
Visual Studio 2015 -> New empty Web Application
Installed current Umbraco nuget package
Published in a new Web App on Azure -> Works fine.
By default Umbraco uses SQL Server Compact Edition
<add name="umbracoDbDSN" connectionString="Data Source=|DataDirectory|\Umbraco.sdf;Flush Interval=1;" providerName="System.Data.SqlServerCe.4.0" />
To use an Azure DB backend I followed the following approach:
Create new Azure DB in Azure
Used SQL Server Compact & SQLite Toolbox to extract a SQL script from the Umbraco.sdf file
Executed the SQL script in my Azure DB
Changed the connection string in the Web.config
<add name="umbracoDbDSN" connectionString="Data Source=tcp:mysqlserver.database.windows.net,1433;Initial Catalog=umbraco-homepage;User ID=myuser;Password=mypassword;Connect Timeout=30;Encrypt=True;TrustServerCertificate=False" providerName="System.Data.SqlClient" />
Re-deployed the application with Visual Studio to my Azure Web App
When I open my web site Umbraco starts an upgrade and I receive the following error message:
What do I need to do to get Umbraco running with Azure DB? This guide seems to be outdated. The object "umbracoUserLogins" does not seem to exist (it was not necessary for SQL Server CE). How can I fix it?
Edit:
When I customise the Azure SQL connection I always get the error message "Could not connect to database". I tried to follow this guide. I typed in my server data like this:
Anything I forgot? Within the Visual Studio SQL Server Object Explorer I can reach the database.
My database configuration looks like this:
Choose "customize" during the setup and use the details from the connection string to fill in the connection data for SQL Server.
In order to restart the installer, remove the configuration status, set it like:
<add key="umbracoConfigurationStatus" value="" />
And empty out the connection string too:
<add name="umbracoDbDSN" connectionString="" providerName="" />

cannot sign in to Azure Visual Studio

I have installed Azure SDK 2.8, Update 5 and App Insight Tools. After installing them, I am unable to Sign in to Azure using Server Explorer. It basically doesn't throw any error but it repeatedly comes back to the Server Explorer screen after entering the user name and password for Azure.
This is the first time I am using Visual Studio to log on to Azure. I am able to log on to Azure portal. The user name and password are definitely correct. It is something to do with Visual Studio.
This was resolved by adding the following piece of code to devenv.exe.config file. This file can be found in
Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true"/>
<settings>
<ipv6 enabled="true"/>
</settings>
</system.net>

Linq to SQL Impersonation

I have an ASP.MVC 3.0 application. My solution is containing a Linq to SQL project (.dbml). I0ve made the choice to put it in a different project and not in the web application project. I also have another project which connect "mannually" to the database (DAL).
I deploy my application on a webserver, activate the impersonation and the Kerberos delegation. Impersonation for the DAL is working fine, but for an unknown reason the Linq to SQL impersonation is not working. Do I miss something?
Here is the web.config form the web application:
<identity impersonate="true"/>
Here is the app.config from the Linq to SQl project:
<connectionStrings>
<add name="testConnectionString"
connectionString="Data Source=SERVERNAME;Initial Catalog=DBNAME;Integrated Security=True;"
providerName="System.Data.SqlClient" />
</connectionStrings>
Do I miss something in the server configuration, or in the delegation?
Here is the app.config from the Linq to SQl my project:
<connectionStrings>
<add name="DefaultConnection" connectionString=
"server=server name or ip addrress;database=dbname;uid=id;pwd=pass"
providerName="System.Data.SqlClient" />
</connectionStrings>

Resources