ASP.NET web application cloud authentication sql dependency

Gareth Parry 1 Reputation point
2022-06-22T11:20:41.583+00:00

HI,

I have created a project in visual studio using the ASP.NET web application (.NET Framwork) VB.
If i run it from within VS it asks for my MS credentials and registers the app in Azure. It then gives me the home page showing as me logged in.

I then deploy this app to IIS on a VM server in Azure. i create a self signed certifcate in IIS and create a https binding using the certificate and port

when i browse to the site it goes through all the login procedure as expected, then i get an error "A network-related or instance-specific error occurred while establishing a connection to SQL Server"

What SQL server??

if i go into connected services in VS under connected services it shows 'SQL Server dependency is detected' and i have to configure it. what is this?

Thanks

Gareth

SQL Server on Azure Virtual Machines
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. shiva patpi 13,261 Reputation points Microsoft Employee
    2022-06-23T05:28:10.07+00:00

    Hello @Gareth Parry ,
    This is what I was thinking !
    When you run the ASP.net application from the visual studio and after performing the authentication - those user details will be stored in SQL Server localdb which gets created automatically where it stores all ASPnetRoles, userClaims , UserLogins , UserRoles etc.
    Try to check out your web.config file , it might have some entries like below ?

    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-20220416092237.mdf;Initial Catalog=aspnet-20220416092237;Integrated Security=True" providerName="System.Data.SqlClient" />-->

    214202-image.png

    Probably , it is complaining about that auto generated localdb SQL Server...

    Regards,
    Shiva.

    0 comments No comments

  2. Gareth Parry 1 Reputation point
    2022-06-23T08:47:15.487+00:00

    Hi,

    thank you for replying. I have found the entry in the web.config. i can comment out this line?

    if i do this i get a new error once i have done the log in routine: IDX21323: RequireNonce is '[PII is hidden

    i have also noticed the browser is saying the site is not secure, even though i have a self signed certificate against the bunding

    thanks

    Gareth

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.