2014-12-02 25 views
0

我試圖運行從Visual Studio 2013部署到IIS的asp.net MVC項目。得到它運行,但是當我登錄(應用程序有用戶認證),我得到:asp.net IIS web部署,登錄錯誤:初始化字符串的格式不符合從索引0開始的規範

Format of the initialization string does not conform to specification starting at index 0.

不知道這意味着什麼,但基於搜索現在看來,這可能與此連接字符串。我不知道問題是什麼,因爲這個字符串與那些字符串非常不同。這在從Visual Studio中的IIS Express運行時工作正常。

<add name="ProductDBEntities" connectionString="metadata=res://*/Models.DataModel.csdl|res://*/Models.DataModel.ssdl|res://*/Models.DataModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(LocalDB)\v11.0;attachdbfilename=|DataDirectory|\ProductDB.mdf;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /> 

感謝

編輯:會不會是一個問題,用(在C內的Inetpub:/驅動器)寫入到文件夾具有受限權限?或濫用LocalDB?另外,發佈時我沒有在遠程連接字符串文本框中放入任何東西,因爲我不知道該放什麼東西。這是問題嗎?

如果我刪除從我的HomeController的[授權]標籤,我得到

A network-related or instance-specific error occurred while establishing a connection 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: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details. )

這似乎是實際兩個不同的問題。 我在我的應用程序池中將setProfileEnvironment更改爲「true」,並修復了第二個問題,但不是第一個問題...

回答

1

缺少asp.net標識正在使用的數據庫的連接字符串從一個樣本項目的一切,但我不知道我在做什麼,所以我錯過了一些東西)

這是我在connectionStrings裏面添加的項目Web.config(直接從asp.net示例項目中複製我基於我自己的項目關閉了)

<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=WebApplication4-2-1-alpha1;Integrated Security=SSPI" providerName="System.Data.SqlClient" /> 
相關問題