2013-07-15 4 views
-3

Я пытаюсь развернуть свой первый веб-сайт, содержащий базу данных. Тест локальная версия имеет следующие строки подключенияweb.config connectionStrings на сервере производства

<connectionStrings> 
    <add name="ApplicationServices" 
     connectionString="data source=.\SQLEXPRESS;IntegratedSecurity=SSPI; 
          AttachDBFilename=|DataDirectory|\aspnetdb.mdf; 
          User Instance=true" 
     providerName="System.Data.SqlClient" /> 
    <add name="ConnectionString" 
     connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\AHData.mdf;IntegratedSecurity=True" 
     providerName="System.Data.SqlClient" /> 
</connectionStrings> 

я установки базы данных на веб-сервере компании, и они дают мне следующие подключения струне

Provider=sqloledb;Data Source=db479427514.db.1and1.com,1433;Initial Catalog=db479427514;User Id=dbo479427514;Password=****; 

Provider=sqloledb;Data Source=db479427535.db.1and1.com,1433;Initial Catalog=db479427535;User Id=dbo479427535;Password=****; 

Когда я заменить локальное соединение тест строки с новым сервером с помощью

<connectionStrings> 
    <add name="ApplicationServices" 
     connectionString="Provider=sqloledb;Data Source=db479427535.db.1and1.com,1433;Initial Catalog=db479427535;User Id=dbo479427535;Password=**I've used real password!**;" 
     providerName="System.Data.SqlClient" /> 

    <add name="ConnectionString" 
     connectionString="Provider=sqloledb;Data Source=db479427514.db.1and1.com,1433;Initial Catalog=db479427514;User Id=dbo479427514;Password=**I've used real password!**;" 
     providerName="System.Data.SqlClient" /> 
</connectionStrings> 

Я получаю следующую ошибку

Keyword not supported: 'provider'.

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.ArgumentException: Keyword not supported: 'provider'.

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.

[ArgumentException: Keyword not supported: 'provider'.]

[ArgumentException: An error occurred while attempting to initialize a System.Data.SqlClient.SqlConnection object. The value that was provided for the connection string may be wrong, or it may contain an invalid syntax.
Parameter name: connectionString]

Может кто-нибудь сообщить, что здесь не так?

+0

http://social.msdn.microsoft.com/Forums/vstudio/en-US/77ff9db1-c69d-4a14-b606-d208832b8756/keyword-not-supported-provider –

ответ

2

Попробуйте удалить раздел «поставщика» строки подключения:

<add name="ApplicationServices" connectionString="Provider=sqloledb;Data Source=db479427535.db.1and1.com,1433;Initial Catalog=db479427535; User Id=dbo479427535;Password=**I've used real password!**;" providerName="System.Data.SqlClient" /> 

становится

<add name="ApplicationServices" connectionString="Data Source=db479427535.db.1and1.com,1433;Initial Catalog=db479427535;User Id=dbo479427535;Password=**I've used real password!**;" providerName="System.Data.SqlClient" /> 

Поскольку имя поставщика указан в его собственной пары имя-значение (providerName=) Я сомневаюсь, что потребуется в строке соединения. Дайте ему треск и отчитайтесь.

+0

Спасибо, что исправлено. – user3357963

1

Исправьте Подключение Стинг:

<connectionStrings> 
    <add name="ApplicationServices" connectionString=" 
    Data Source=db479427535.db.1and1.com,1433;Initial Catalog=db479427535; 
    User Id=dbo479427535;Password=**I've used real password!**;" 
    providerName="System.Data.OleDb" /> 

    <add name="ConnectionString" connectionString=" 
    Data Source=db479427514.db.1and1.com,1433;Initial Catalog=db479427514; 
    User Id=dbo479427514;Password=**I've used real password!**;" 
    providerName="System.Data.OleDb" /> 
    </connectionStrings> 

Это происходит потому, что мы не имеем объект поставщика в строке подключения, так что удалить, что и указать имя поставщика в разделе «ProviderName» строки подключения к: System.Data .OleDb

Смежные вопросы