SqlException (0x80131904): Login failed for user 'db123' - asp.net

I get this error when I upload the website on the server, ie parallels plesk server. I create the tables on the plesk server and selects SQL server 2012. But I think this is a connection string error. If you know about this error please guide me.
Server Error in '/' Application.
Login failed for user 'db123'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'db123'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

The Error say you are trying to connect to SQL Server with user db123 which is not exists or exists but you provide wrong password.
To fix the problem
check if the db123 login exists on your SQL Server from plesk panel and is exists in your database users
Open your web.config file to find the connection string section and see the passwrod, then check if the password of db123 login is the same or not
Try connect to you SQL server (on host) from your local SQL Server Management Studio with the user and password which is provided in your web.config to see that everything is fine or not

The problem definitely is from the login credentials. But check to see if you are using Windows authentication.
If you used a default instance during the installation of SQL Server Express, then in the connection string at web.config, clear the username and password portion and set integrated security to true. That worked for me.
With my problem, the SQL server login panel had a user name, but since I was using the default instance, ASP.net did not recognize the username as a valid one even though in principle it was supposed to work. So check integrated security and set it to true. It might work for you

Related

WebDeploy - Not able to log on the user '.\WDeployConfigWriter'

I have problem with MsDeploy to publish my website to remote IIS from Visual Studio.
I encountered the following error:
Microsoft.Web.Delegation.DeploymentAuthorizationException: Not able to
log on the user '.\WDeployConfigWriter'. --->
System.Runtime.InteropServices.COMException: The user name or password
is incorrect. (Exception from HRESULT: 0x8007052E) --- End of inner
exception stack trace --- at
Microsoft.Web.Deployment.LogonUserHandle.LogonUser(String userName,
String domain, String password)
I tried to change WDeployConfigWriter's password in Local Users and Groups (lusrmgr.msc).
Then, I open Management Service Delegation.
I try to set credentials in edit rule for WDeployConfigWriter page and it's always fail with message "The spesified password is invalid. Type a new password".
I am working in Windows Server 2012.
Any help would be appreciate.
Thanks!
I had this too but with a slightly different detail
Not able to log on the user '.\WDeployConfigWriter'.
Logon failure: the specified account password has expired.
Full credit to this blog, the problem is that the Web Deploy installer creates users with expiring passwords that are used to elevate permissions during deployment. The fix is to:
Use server manager on the accounts WDeployAdmin and WDeployConfigWriter to
reset the password
check password never expires
uncheck user must change password next logon
Use IIS -> Management Service Delegation to reset the passwords for the rules where those accounts have been configured to elevate to a specific user
Fixed!
The easiest fix to this problem is:
Computer Management ->Local Users And Groups -> Users
Right click -> properties on WDeployAdmin
Uncheck "User must changed password at next logon
Check "Password never expires"
Do the same for WDeployConfigWriter
Done!
Similar to #fiat solution, but you don't really need to change the password.
Here are simple CMD commands:
WMIC USERACCOUNT WHERE "Name='WDeployConfigWriter'" SET PasswordExpires=FALSE
WMIC USERACCOUNT WHERE "Name='WDeployAdmin'" SET PasswordExpires=FALSE
It will set deploy users passwords to never expire
The WDeploy* users are not intended to be used directly as part of your deployment process. Instead, they are used to implicitly elevate permissions in order to perform specific tasks (modifying IIS for WDeployConfigWriter, and GAC installations among others for WDeployAdmin).
I'd recommend creating a non-admin user specifically for your website. You can find the instructions for doing so at Installing and Configuring Web Deploy on iis.net. If you continue to have problems with the WDeployConfigWriter user, you're probably best off uninstalling Web Deploy and starting again.
In my case, I got this error because either WDeployConfigWriter nor WDeployAdmin had been created during the installation of WebDeploy (3.6 / 4.) even if the installation ran through successfully.
Found out, that the servers rule for password complexity was more restricting that the generated one with the script in C:\Program Files\IIS\Microsoft Web Deploy V3\Scripts\AddDelegationRules.ps1 didn't meet the requirements.
So I edited GenerateStrongPassword() in the PowerShell file and run it.
The users then have been created successfully.
There is some cases where setting "Password never expires" not is enough. Reinstalling webdeploy will fix the issue.
The other way to fix this is to set new passwords for the users WDeployAdmin and WDeployConfigWriter.
User management
The next step is to set the new passwords in IIS > Management Service Delegation for those users.
Management Service Delegation
I had the same problem trying to changes the passwords in Management Service Delegation and it did not fix the problem. It turns out that I had to change the WDeployConfigWriter to a different user(ie Admin) change it back and then the password changes only took effect
I had the same problem with Visual Studio 2017 with a different error message. The solution is also uncheck (WDeployConfigWriter) "User must changed password at next logon"
Publish failed
Publish has encountered an error.
Publish failed due to build errors. Check the error list for more details.
A diagnostic log has been written to the following location:
"C:\User\MyUser\AppData\Local\Temp\tmpXXXX.tmp"
The content of the log file
06.04.2018 19:56:13
System.AggregateException: One or more errors occurred. ---> System.Exception: Publish failed due to build errors. Check the error list for more details.
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Web.Publish.PublishService.VsWebProjectPublish.<>c__DisplayClass40_0.<PublishAsync>b__2()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.ApplicationCapabilities.Publish.ViewModel.ProfileSelectorViewModel.<RunPublishTaskAsync>d__108.MoveNext()
---> (Inner Exception #0) System.Exception: Publish failed due to build errors. Check the error list for more details.<---
===================

Error while running the published website on IIS 7.5

I have an asp.net website which is developed in asp.net 4.0 with data binding from a database which is maintain in sql server 2000..
It it working fine on localhost but when I am deploying it on IIS and while running the page following error is occurring.
Login failed for user 'testuser'. Reason: Not associated with a trusted SQL Server connection.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: Login failed for user 'testuser'. Reason: Not associated with a trusted SQL Server connection.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
I am using mixed mode authentication and sql server 2008 is installed
on my system
I am using the following connection string in my .cs
page
using (OleDbConnection con3 = new OleDbConnection("Provider=SQLOLEDB;Data Source=sbs;User ID=testuser;Passwrd=pinkCITY01;Initial Catalog=PCGnet"))
try adding Integrated Security=SSPI to connection string
or refer below link
Login Failed 'sa'

SQL Server 2008 R2 Express error: Cannot open database "PersonnelPro" requested by the login. The login failed

I am using SQL Server 2008 R2 Express and the "SQL Server and Windows Authentication" mode in my database. I can open the database using Enterprise Manager, but when I run my aspx application, I get:
Cannot open database "PersonnelPro" requested by the login. The login
failed.
My web.config connection string is:
<add name="dbString"
connectionString="Provider=sqloledb;Data Source=AREA51\SQLEXPRESS;Initial Catalog=PersonnelPro;User Id= ****;Password= ****" />`
I searched the web and SO, but could not find a solution. Any ideas what would be causing this issue?
Update:
Looking into SQL log files ("C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\Log"), I find this:
2012-12-21 05:58:00.97 Logon Error: 18456, Severity: 14, State: 38.
2012-12-21 05:58:00.97 Logon Login failed for user 'PersonnelPro'. Reason: Failed to open the explicitly specified database. [CLIENT: <named pipe>]
This web application is by a 3rd party company. So technically, I only need to configure my web.config file and it should work.
Remove the space after the '=' sign for User Id and Password. I think it is being interpreted as part of the value.
Update:
The new error message you posted (Failed to open the explicitly specified database.) can mean one of two things:
The DB with that name doesn't exist or is misspelled.
The user you are trying to log in with does not have access to the DB. You can check this by running exec sp_helpuser 'username' in the DB.

Security issue accessing microsoft interop dll sending email

We have a simple piece of code here that recently stopped working and I have tried many 'things' to try and resolve the error.
The code
Application outLook = new Application(); :)
The error
Retrieving the COM class factory for component with CLSID
{0006F03A-0000-0000-C000-000000000046} failed due to the following
error: 80070005. Description: An unhandled exception occurred during
the execution of the current web request. Please review the stack
trace for more information about the error and where it originated in
the code.
Exception Details: System.UnauthorizedAccessException: Retrieving the
COM class factory for component with CLSID
{0006F03A-0000-0000-C000-000000000046} failed due to the following
error: 80070005.
ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request
identity. ASP.NET has a base process identity (typically
{MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if
the application is not impersonating. If the application is
impersonating via , the identity will be
the anonymous user (typically IUSR_MACHINENAME) or the authenticated
request user.
To grant ASP.NET access to a file, right-click the file in Explorer,
choose "Properties" and select the Security tab. Click "Add" to add
the appropriate user or group. Highlight the ASP.NET account, and
check the boxes for the desired access.
Now whilst the error is quite obvious I cannot resolve it.
The application is a .net 2.0 web application and the server is windows 2008 r2 standard using IIS 7.0
Thanks
Using Client appliactions on a server is always going to be problematic - there are other ways to access mailboxes.
That said, this might help:
http://technoblogy.net/retrieving-the-com-class-factory-for-component-with-clsid-00024500-0000-0000-c000-000000000046-failed-due-to-the-following-error-80040154/

Please help me to upload image file to my site in asp.net-vb error

i want upload file to my site but give a error message
Access to the path 'C:\hshome\jahanmap\jahanmap.com\default\tatlises-rop.jpg' is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:
System.UnauthorizedAccessException:
Access to the path
'C:\hshome\jahanmap\jahanmap.com\default\tatlises-rop.jpg'
is denied.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via , the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
Line 67: ' save the image
Line 68: saveFile = Path.Combine(savePath, FileUpload1.FileName)
Line 69: FileUpload1.SaveAs(saveFile)
Line 70:
Line 71: ' for product images we also create a thumbnail
The error message in your question gives you all the information you need - you need to give your ASP.NET account write access to the folder you are trying to access - the error message tells you exactly how to do this.
It seems you don't have access right to the path.
You need to change the access right and then test again.

Resources