i have developed an application and it is working fine but when ever i create a virtual directory for it in IIS and run the application i am getting connection failure exception and named pipes exception.
thanks!
It looks like you having some issue with the database connection from your application. Can you post your code and the exact nature of the error.
Without any code or details of the language it is hard to guess what the issue can be however a common one that occurs with asp.net could be your database connection string. Are you using a SQl Server / Sql Server Express database with your application? You need to check that the connection string.
The problem is the Integrated Security=True setting in your connection string. IIS uses the ASPNET windows login which will be different to the Windows login used when running from VS. You've got a few options:
Grant the ASPNET user the required access rights on your database
Use Sql Server authentication: Set up a user on the database as a sql login and pass this username / password in on the connection string and set Integrated Security=False
Change the identity IIS runs under to one that has access to the DB.
There may be other options also however I think these are most common. Which to choose depends on the architecture you are deploying to, personally I almost always go for Sql Server Authentication using a username and password. The web.config can be encrypted for further security if required.
Related
I have developed a c# windows application which uses SQL server 2012 database in Visual Studio 2015 which is running well on my pc.
I am to install this application on a number of computers without SQL server installed on it, but when I run the application, its gives me database connection error.
My question is, how can I create the setup file to be able to run the app on those clients pc without installing SQL server on all those computers. Please I need your help.
Thank you.
Am Emmanuel.
Use an Azure database and have the clients connect to that.
Have a look at https://azure.microsoft.com/en-us/services/sql-database/
Alter your application connection string and make sure you keep the connection string secret.
Server=tcp:myserver.database.windows.net,1433;Database=myDataBase;User ID=mylogin#myserver;Password=myPassword;Trusted_Connection=False;Encrypt=True;MultipleActiveResultSets=True;
An important fact is that the clients need to allow communication via port 1433.
If this is not an option create an API application and query the database via that.
If you need a private database per client you can use a database file and connect to the file
https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/sql-server-express-localdb?view=sql-server-ver15
Update based on reply
You can create a pop-up on the application allowing the users to add valid settings and credentials when your appsettings.json is blank or "a test connect" to the database fails.
I am trying to get a flask app deployed to a windows server (IIS 7.5) that passes the client NTLM Windows Authentication to the SQL Server connection in SQL Alchemy.
At the moment the connections string looks like this:
"DRIVER={SQL Server Native Client 11.0};Server=%s;Database=%s;TDS_Version=8.0;Trusted_Connection=yes;"
And the Trusted_Connection=yes serves to pass the owner of the web server process to SQL Server. This works great when running the development server because I am invoking the server so my access credentials get passed. BUT when IIS runs the server it inherits the application pool identity and sends a bogus non domain user as the auth credentials.
I have tried to use the WindowsAuth setting in the webconfig but SQLAlchemy keeps passing the app pool identity to the sql server.
I've had similar issues with SQL DB Connections, and the workaround that worked was to create a Windows Network User and have IIS run applications with that identity instead of the App Pool identity. This 'real user' identity is then passed on to any downstream invocations (SQL).
This scales well in an enterprise environment and prevents most security change problems because the user is a 'normal user' and only nominally a 'service account'.
We have an MVC3 site that uses the ASP.NET Membership Provider with Forms Authentication to let users onto the site. We have an Oracle database behind it.
It all works in house on development machines, test machines and deployment machines.
But at a client - they are getting the error "ORA-12154: TNS:could not resolve the connect identifier specified".
We thought this would be a simple case of a wrong config entry but all seems correct. They've also run a tnsping to the same TNS alias and it works. A connection via SQL*Plus also works. We've even got them to download a .NET connection string tester application and that connects ok using exactly the same connection string as the MVC3 site web.config has. It's only the website that comes back with this error. (note: all the tests were done from the same machine as the website is on)
Has anyone seen this before and provide some guidance on how to solve?
Thanks
The likely cause for this, from experience, is that the account under which the application is running is unable to read/access the TNSNAMES.ORA file, either due to file/folder permissions or network access permissions.
I have done subsequent research on how to connect to SQL Server remotely and even configured it to allow remote connections.
Now I can connect to my sql server instance on remote computer through SSMS but while connecting through my vb.net application I get the exception
Login failed for USER.The user is from an untrusted domain and cannot
be used with windows authentication
Please help me to tackle this problem.
Here is my connection string
Server=ACLMUMBAI;Database=Agrichemdb;User ID=xyz;Password=xyz;Trusted_Connection=Yes;
Thanks in advance.
You could try with
Server=ACLMUMBAI;Database=Agrichemdb;User ID=xyz;Password=xyz;Trusted_Connection=False
Then you need SQL Servers authentication in mixed mode and that there is a SQL Server login as per UserID in above connection string, with matching password and with appropriate permissions against your database.
Let me say also that this solution is not very secure and, if this database is exposed on Internet, you need very strong passwords. And despite this you will get numerous brute-force attacks and unexpected guests.
This may be a basic question but I'm not very proficient in SQL Server.
I am Using Visual Studio 2008 Professional.
In a ASP .NET MVC 3 project I created a database that resides in 'App_Data'.
The web.config file uses this as the connectionString (partial):
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;
When I copy the project to a the production server the initial MVC logon page appears ok. When I entire in the login username/password I get a
Failed to generate a user instance of
SQL Server due to a failure in
starting the process for the user
instance
error message.
The SQL Server Express 2008 instance on the production system is set use 'Local System' for authentication.
I think that I'm not configuring SQL Express or my web.config correctly?
UPDATE1
Most of the links found on the internet talk about deleting a folder. In my scenario there is no 'C:\Documents and Settings\YOUR_USERNAME\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS' folder.
My solution for now (after much ASP .NET/IIS/SQL SErver security review) was to set "User Instance=True" to "User Instance=False" in the production web.config file.
Per your connection string, you're using Windows security to control access to the database. Does the account under which your web server runs have sufficient permissions on your database?
You may wish to test using SQL Server security, just to confirm this is the problem. (Assuming SQL Server was installed with SQL Sercurity enabled.)
Did you try this already? Fix error "Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance."