0

I have been struggling for this seemingly easy problem for months. I have done research as much as I could and found a few proposed solutions, but none of them work for me.

So I have this .Net application which is configured to use IIS. When I first run it it gives me this "SQL Network Interfaces, error: 50" error. And I found this link: how to fix Sql network interface error 50

I edited the applicationHost.config file to this

<add name="ASP.NET v4.0" autoStart="true" managedRuntimeVersion="v4.0"     managedPipelineMode="Integrated">
<processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="true" />

And now I got this new error "Login failed for user IIS APPPOOL/(IIS site name goes here)"

And found this new link how to fix login failed for user error

I added the username to Sql server, give every possible rights to it. Never worked.

My other apps all connect smoothly to their database in the same machine, I even create a mock app that is not configured with IIS, it can also connect to the database. So it rules out the problem of the db server. There must be some setting I do not get it right in IIS.

My db connection string is like this :

        <add key="MainConn" value="Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=db name; User ID = userid password=password" />

I tried getting rid of the user name and password, using/not using integrated security=False to not avail

Frostless
  • 818
  • 1
  • 11
  • 33

1 Answers1

0

Found the solution. Seems like the db instance IIS connects to is different to the db instance connected by VS. So using named pipe can make them pointing to the same instance.

Got the named pipe by executing SqlLocalDB info MSSQLLocalDB in command line.

Credit : reference

Frostless
  • 818
  • 1
  • 11
  • 33