skip to Main Content

i’ve been using asp.net mvc project with entity framework.
Recently, i published my app on a plesk panel, trying to reach web page but i got this:

The connection string ‘ModelMainContainer’ in the application’s configuration file does not contain the required providerName attribute.”

Here are my connection strings:

  <connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=.MSSQLSERVER2012;Initial Catalog=AdvertisingDB;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|AdvertisingDB.mdf providerName=&quot;System.Data.SqlClient&quot;" />
<add name="ModelMainContainer" connectionString="provider=&quot;System.Data.SQLClient&quot;;provider connection string=&quot;data source=.MSSQLSERVER2012;initial catalog=AdvertisingDB;User ID='******';Password='*******';MultipleActiveResultSets=True;App=EntityFramework;&quot;providerName=&quot;System.Data.EntityClient&quot;" />

As you can see, there actually is a providername attribute.

Since Plesk panel doesn’t allow any manual changes on web.config, i’m using asp.net settings on websites&domains tab. so i can’t interfere with that “quot”s in file, but i don’t really think they are the problem.

Any ideas? Thanks.

2

Answers


  1. Chosen as BEST ANSWER

    I got this with publishing my web.config properly. It seems the problem is defining my providerName to right place. For example, if i try to define providerName in the Plesk connection string manager, it simply doesn't work that way.


  2. You will need to Edit the Web.Config file manually. The ASP.NET Settings page will remove the providerName.

    An example of a connection string using EntityClient is below. You can remove the metadata information if you’re not using an Entity Model. You will notice the providerName is outside of the actual connectionString and is the reason you will need to edit the file manually.

    connectionString=”metadata=ModelInformation;provider=System.Data.SqlClient;provider connection string="data source=IP;initial catalog=DATABASE;User ID=USERNAME;Password=PASSWORD;multipleactiveresultsets=True;application name=EntityFramework"” providerName=”System.Data.EntityClient”

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search