✅ IIS >> .NET 9 API >> SQL Connection String set up.
Hello All, I am new to .NET (LAMP dev background) I am trying to learn .NET as best I can but i have hit a roadblock in trying to deploy to an IIS server. I know where my issue is but I cannot figure out how to configure it correctly.
I have built a simple REST API and have tested the code, it works in Visual Studio. I have SQL Developer installed on my machine and my code persists to it just fine in VS. Now, all i am trying to do is "deploy" it to IIS (locally, all of my assets are local, no remote connections). Now I know it has to do with the way my application is communicating through the IIS server to the SQL instance. I have many different ways based on documentation I have found, but nothing is clearly straight forward.
From what I can tell there are two possible ways to connect IIS communication from the app to the SQL server. 1. Windows Authentication Creds 2. Some sort of trusted pass through (because its all local).
If I could get an example of what i am supposed to create for the connection string and where to put it (appsettings.json or connection strings in IIS config ... or both???) That would be helpful.
51 Replies
IIS has nothing to do with how your app talks to your database
also, i wouldn't start using IIS if you don't have a specific reason to
all your app needs is a valid connection string for your db, which will depend on how your db is set up and where it's hosted
there are a million ways to get the connection string into your app, whether that's environment variables, appsettings, some other file, a cloud secret storage service, etc
Unknown User•4d ago
Message Not Public
Sign In & Join Server To View
If you have no further questions, please use /close to mark the forum thread as answered
Unknown User•4d ago
Message Not Public
Sign In & Join Server To View
I know this is going to come off the wrong way, but I just have to point things out as they happen. Jimmale ... "IIS has nothing to do with how your app talks to your database" actually, I am pretty sure it does, see picture1 from IIS Manager.
"i wouldn't start using IIS if you don't have a specific reason to
all your app needs is a valid connection string for your db, which will depend on how your db is set up and where it's hosted" The reason for me to use IIS was not part of my initial questioning, but since you mentioned it, yes I do have a valid reason to use IIS. However, none of those reasons pertain to the initial inquiry that I posted.
"there are a million ways to get the connection string into your app, whether that's environment variables, appsettings, some other file, a cloud secret storage service, etc" This response kinda gets in the ballpark of what I originally was asking, however still comes short on actual sustenance.
As I mentioned in my post, I am trying to "deploy" my application to my local IIS server, WHICH in turn, my app would communicate with my database instance. IE... I am trying to mimic deploying an application to a server, similar to how it would be done on a remote server (ie The need to use IIS and learn it).
As far as the "million ways" to do it, I doubt that, but there are a few that I know of...: AppSettings.json, web.config,and also....I am assuming the IIS configurations and perhaps more.
So, in short, I suppose thanks for attempting to assist me, albeit completely off the mark. I guess I'll have to find what I am looking for elsewhere.

cool beans, good luck
i'll be over here with my ASP.NET Core app hosted in IIS that has no IIS specific database code and works fine
Yes, I know my connection string needs to be updated, my question is how??? Firewall is good 👍
I think this might be close to what I am looking for, but again "how" is the question. I have seem lots of stuff regarding these topics in MS docs and other forums, but nothing that really "explains" it
it seems the issue is you don't know enough to know what you need to know, in which case telling the people who do know that they don't know what they're talking about is counterproductive
Wow, you've got some issues bud
the reason i asked about IIS is because it's only one option for deploying an ASP.NET Core app (and not a good one), and the reason i can't be specific about the connection string is because you haven't mentioned how you want to authenticate to it
This is the "help" forum, right?
yes, so when people offer help telling them they're wrong isn't a great look
From what you are saying is , If I dont know, well then I shouldn't even bother asking becasue I am not as good as you ?
Unknown User•4d ago
Message Not Public
Sign In & Join Server To View
What isn't a good look is your arrogant response.
pot meet kettle
good luck with your problem
@Jimmacle dude, just go away..... geeze
i'm just confused why you're sabotaging your own post :PepeLaugh:
Unknown User•3d ago
Message Not Public
Sign In & Join Server To View
have we even established that we're using windows authentication?
Unknown User•3d ago
Message Not Public
Sign In & Join Server To View
@tobeco now this sounds more like on the mark of what I am looking for,,,,,, thanks @tobeco
the project is not serious at all.
its just a test env/sandbox......
Unknown User•3d ago
Message Not Public
Sign In & Join Server To View
as I said in my initial post, I am a LAMP dev, I havn't done anything remotwly close to .NET in over 15 years
there's no real reason to use IIS unless you actually plan to deploy to an IIS server, which nobody here will recommend if you have a choice
especially for local dev
user/pass is how I think I initially set it up, but I still get 500
Unknown User•3d ago
Message Not Public
Sign In & Join Server To View
500 is not a database error, that is an error returned by your application so you'll need to check your application's logs
geeze he is still talking 😕
Unknown User•3d ago
Message Not Public
Sign In & Join Server To View
the 500 error is because my API call cannot connect to the DB
and what does that error say?
I verified in the error logs
full stack trace if possible
Unknown User•3d ago
Message Not Public
Sign In & Join Server To View
sec ....
correction ..... SQL log error, the 500 is being returned to the browser ....
06/02/2025 10:22:00,Logon,Unknown,Login failed for user 'TCH-AZ\ITAPW11$'. Reason: Could not find a login matching the name provided. [CLIENT: <local machine>]
06/02/2025 10:22:00,Logon,Unknown,Error: 18456<c/> Severity: 14<c/> State: 5.
so what does that tell us
my connection string is not configured correctly, which is what I knew
i mean, it could be correct depending on how you want to authenticate and you have misconfigured your sql server
do you want to use windows authentication or a sql user/password?
either/or honestly, our production is already set up here for ISS so, all I will really have to do is deploy the code. i am jsut trying to get a simple test/dev enviroment going so I can mimic AND learn as best I can. Everything I am trying to do is all local. nothing of what I am trying to do is gong to be production settings. This is just a sandbox text
the second way is generally less painful
I initally set it up for windows auth
add a user to your db with sql authentication, then use that username and password in the connection string
that didnt work, so I tried to use user/pass
it looks like your current connection string is set up for windows authentication, and it's complaining that the user your app is running as doesn't have a database login
remove
trusted connection
and/or integrated security
from the connection string, that's just a confusing way to say use windows authentication
or just add a login for that userok, ill try that
Unknown User•3d ago
Message Not Public
Sign In & Join Server To View
Outside of containers, what would the recommendation be for server-side deployment without IIS?
Granted, I'm probably looking to use JS frontends and not MAUI/Blazor, but that's beside the point
regular old service
kestrel itself is a production ready web server
reverse proxy it behind something else if that tickles your fancy, but it's not required
Yeah, that's fair. I still deal with a lot of .NET Framework which is beyond annoying, but for the .NET8+ it's straight forward.
Unknown User•3d ago
Message Not Public
Sign In & Join Server To View