So I'm in the process of making the configurations for my site on Plesk Web Host Edition but unfortunately I have an issue of accessing the database through my website.
I have noted the following:
1. I can access the Database through SQL Server Management Studio (SSMS) without any issues but one important thing to mention is that when I try to make my DB user as the owner of the database I get the following error:
Cannot alter the role 'db_owner', because it does not exist or you do not have permission. In other words, I'm not the owner of the database and I can't alter anything in it! although that I have created the database and the DB user through Plesk Panel.
2. I configured the web.config as follows:
<add name="xxxConnectionString" connectionString="data source=127.0.0.1\SQLEXPRESS;server=127.0.0.1;database=xxxx.mdf;Uid=xxx;pwd=xxxx" />
3. When accessing the website I get the following error:
Cannot open database "xxx.mdf" requested by the login. The login failed.
Login failed for user 'xxx'
I contacted the support of the hosting provider but it's been almost 4 days now without any reply. I'm really hoping of finding the answer with you guys.
Thanks in advance
I was able to find a solution for the ConnectionString issue. Below is the connection that I used to fix the issue:
<add name="CarRentalConnectionString" connectionString="Data Source=localhost;Initial Catalog=DATABASENAME;Integrated Security=false;User ID=USERNAME;Password=PASSWORD" />
Related
I created an ASP.NET MVC5 project with default template and individual user account authentication (identity).
I changed default connection string to connect my existing database that includes all tables necessary for identity.
Here is my connection string:
<add name="DefaultConnection"
connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=MyDB;User ID=sa;Password=123456;"
providerName="System.Data.SqlClient" />
Everything works fine locally, but when I login identity in hosting, I get this error:
CREATE DATABASE permission denied in database 'master'.
Then I tried again with a new project without identity, I add an ADO.NET Entity Data Model connect to my existing database from my project and get some data to show in a view. It works fine locally and in my hosting environment.
Can someone please explain and help to fix error in case 1? Sorry my English is not good, thanks you so much.
My project is working perfectly on local host but I am trying to host it on iis and following error is showing
Steps which I have tried so far:
1.checked my connection string which is
<connectionStrings>
<remove name="umbracoDbDSN" />
<add name="umbracoDbDSN" connectionString="Server=EIL-IT-360-39\SQLEXPRESS;Database=umbraco_16_6;Integrated Security=true" providerName="System.Data.SqlClient" />
</connectionStrings>
2.Using window authentication to login into my DB.
I have also refrered given sites but could not found desired solution:
Umbraco cannot start. A connection string is configured but the Umbraco cannot connect to the database
Umbraco cannot start after switching to local SQL database
Check which identity your website is running under in IIS:
open IIS
got to Applications Pools in the tree on the left
find your website in the list
go to Advanced Settings
switch the Identity to Network Service rather than ApplicationPoolIdentity
I believe this is the user which runs the website. If this doesn't work, you may want to check that your selected Identity has access to the database.
It looks like a permissions/connection issue. Usually this is because either the IIS server can't see the machine "EIL-IT-360-39" (try using the machine's IP address instead). Or the windows authentication isn't working.
If you're using integrated authentication, the site will be connecting as your application pool identity account. You need to make sure that the application pool account has access to read and write to your database. There is a tutorial here on how to do this: https://msdn.microsoft.com/en-us/library/bsz5788z.aspx
Thank you all for your help..my problem is now solved ..though it solved by adding a new user with some password in my ssms and then adding same in connection string as
<add name="umbracoDbDSN" connectionString="..database=umbraco_16_6;user id=sa;password=*****" providerName="System.Data.SqlClient" />
then,my umbraco password was not accepted at login screen[even though I haven't made any changes in that password]..for which I tried to update hashed password and other options..but none of those worked for me..
Then I have had a backup of my DB..which saved my project..and now I am able to login into my Umbraco site as well as hosted it successfully on my network.
please provide the same user name and password that u created while instating umbraco Db.and yor visualstudio connection string should be like
<connectionStrings>
<remove name="umbracoDbDSN" />
<!--<add name="umbracoDbDSN" connectionString="server=PALPIN-022\SQLEXPRESS;database=Databasename;user id=UmbracoDbname;password='umbracodbpassword'" providerName="System.Data.SqlClient" />-->
<!-- Important: If you're upgrading Umbraco, do not clear the connection string / provider name during your web.config merge. -->
</connectionStrings>
note: password should in "''" double quotes inside single quotes.
I am developing a website with the Asp.net MVC5 template. This website have obviously a database with some informations. This MS-Sql database runs on a remote VM. While coding I tested this site with the integrated IIS Express and the mentioned database.
Now I wanted to publish this website on a real IIS 10.0 Server, this IIS Server runs on the same VM as the database.
I published the website as follow:
Right click on project in VS15 > Publish > File System (Publish Method) > Copied the compiled data to the mentioned VM > In the IIS Manager I created a new website based on the compiled source data.
Now the problem:
When I try to run this website (localhost or via remote from my client) the following error occurs:
Login failed for user 'DOMAIN\MACHINENAME$'.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'DOMAIN\MACHINENAME$'.
This two connectionstrings are in my web.config, both are autogenerated from Asp.Net Frameork:
<connectionStrings>
<add name="InfoScreenContext" connectionString="data source=vsdev1972\;initial catalog=InfoScreen;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
<add name="UserProfile" connectionString="data source=vsdev1972\;initial catalog=InfoScreen;integrated security=True;multipleactiveresultsets=True;application name=EntityFramework" providerName="System.Data.SqlClient" />
</connectionStrings>
I was searching a whole day for a solution but none of these approaches worked for me:
Adding this DOMAIN\MACHINENAME$ user to the database users
Enabled Windows Authentication in IIS Manager
Tried to edit the connection string
Granted source access for everyone
Any ideas? If u need any further informations pls contact me!
This is my first project using ASP.net and I'm struggling to get my database connection working.
Right now the database for my application data is working and I can use the website to do simple CRUD operations.
However, when I try to add Authorizarion and Authentication via the Web Site Administration Tool I get the following exception:
Cannot open user default database. Login failed. Login failed for user 'PcName\UserName'.
I have tried solving this problem by using different connection strings, but without luck. They would just break my website functionality.
My connection string is:
<connectionStrings>
<add name="ProjectEntities"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;
database=ProjectDB;
AttachDBFilename=|DataDirectory|aspnetdb.mdf;
User Instance=true"
providerName="System.Data.SqlClient" />
</connectionStrings>
I'm using Visual Studio 2010, with ASP.net MVC 3 and the Entity Framework.
I'm really out of options here, there is way too much information about SQL Server Express and ASP.net and I just can't find any working solution.
EDIT:
I tried several different connection strings as suggested below and found online. I now have a different error when trying to load the Web Site Administration Tool: Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.
When Googling that I found some solutions to fix that problem. One of those was to run aspnet_regsql.exe with some option. When doing that I get the following error message:
An error has occurred. Details of the exception:
A network-related or instance-specific error occurred while establishing a conne
ction to SQL Server. The server was not found or was not accessible. Verify that
the instance name is correct and that SQL Server is configured to allow remote
connections. (provider: Named Pipes Provider, error: 40 - Could not open a conne
ction to SQL Server)
Unable to connect to SQL Server database.
Somehow it seems that the SQL server is not running, or something. My knowledge about this subject is really insufficient to fix this problem.
EDIT 2:
I've done some more research and just tried to run the Web Site Administration Tool of an newly created MVC 3 Internet Application. When going to the security tab it gives me a different error: Could not load type 'MvcApplication1.MvcApplication'.
So my guess is that I'm missing some configurations in Web.config in my initial project (created as empty project), but somehow there is a new problem...
Can you try without specifying database parameter?
<connectionStrings>
<add name="ProjectEntities"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;
AttachDBFilename=|DataDirectory|aspnetdb.mdf;
User Instance=true"
providerName="System.Data.SqlClient" />
</connectionStrings>
Does it creates the .mdf file at all? Are you working on network drive?
the connection string should be:
<connectionStrings>
<add name="ApplicationServices" connectionString="data Source=.\SQLEXPRESS; Initial Catalog=aspnetdb; Persist Security Info=True; Integrated Security=SSPI;" providerName="System.Data.SqlClient" />
</connectionStrings>
I am using SQL Server Web (Full version not SQLExpress). I can connect to the database fine from my VS2010. However when I go to ASP.NET Web Application Administration, click "Security" I got below error:
There is a problem with your selected
data store. This can be caused by an
invalid server name or credentials, or
by insufficient permission. It can
also be caused by the role manager
feature not being enabled. Click the
button below to be redirected to a
page where you can choose a new data
store.
The following message may help in diagnosing the problem: Unable to connect to SQL Server database. "
I know I miss something. Can somebody help?
Thanks
Just a tip, have a look in your web.config file and set YOURMACHINENAME in the data source
<connectionStrings>
<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="Integrated Security=SSPI;Data Source=YOURMACHINENAME ;Initial Catalog=aspnetdb;" providerName="System.Data.SqlClient" />
</connectionStrings>
Hope it help