iT邦幫忙

0

System.ComponentModel.Win32Exception: 系統找不到指定的檔案。

找過網路上的解答 , 但還是看不懂怎麼解決 , 所以來詢問
輸入帳號密碼
https://ithelp.ithome.com.tw/upload/images/20180116/201043260sGWuPCr64.png

出現錯誤訊息

https://ithelp.ithome.com.tw/upload/images/20180116/20104326RvcMNduiay.png

MSSQL
https://ithelp.ithome.com.tw/upload/images/20180116/20104326ISK64gdbPs.png

看更多先前的討論...收起先前的討論...
石頭 iT邦高手 1 級 ‧ 2018-01-16 10:59:35 檢舉
可否貼出你網站的web.config
小魚 iT邦大師 1 級 ‧ 2018-01-16 12:43:15 檢舉
顯然就是沒有那個檔案
alex9453 iT邦新手 2 級 ‧ 2018-01-16 12:47:18 檢舉
謝謝你願意解惑

<?xml version="1.0"?>
<!--
如需如何設定 ASP.NET 應用程式的詳細資訊,請造訪
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>
<!--<add name="ApplicationServices" connectionString="Data Source=.;Initial Catalog=WebDB;User ID=sa;Password=test" providerName="System.Data.SqlClient"/>-->
<add name="SchoolConnectionString" connectionString="Data Source=.;Initial Catalog=School;User ID=sa;Password=test" providerName="System.Data.SqlClient"/>
</connectionStrings>
<!--
如需 .NET 4.5 web.config 變更的說明,請參閱 http://go.microsoft.com/fwlink/?LinkId=235367。

您可以在 <httpRuntime> 標記上設定下列屬性。
<system.Web>
<httpRuntime targetFramework="4.5" />
</system.Web>
-->
<system.web>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime enable="true" targetFramework="4.5"/>
<authentication mode="Forms">
<forms loginUrl="~/Login.aspx" timeout="2880"/>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
<!--
<customErrors mode="On" defaultRedirect="~/ErrorPage.aspx">
<error statusCode="404" redirect="~/Error404.aspx"/>
</customErrors>
-->
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/>
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/>
</providers>
</roleManager>
<pages controlRenderingCompatibilityVersion="4.0"/>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<!--以下三個目錄允許暱名存取-->
<!--主要是用來覆寫掉前面的暱名存取設定-->
<!---否則會造成CSS,Images及JavaScript檔案無法存取,而產生錯誤-->
<location path="CSS" allowOverride="true">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="Images" allowOverride="true">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="Scripts" allowOverride="true">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="Error404.aspx" allowOverride="true">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="ErrorPage.aspx" allowOverride="true">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
</configuration>
石頭 iT邦高手 1 級 ‧ 2018-01-16 13:06:26 檢舉
你確認一下 你本機MSSQL名稱是否是 .
因為你的Data Source是.
alex9453 iT邦新手 2 級 ‧ 2018-01-16 16:15:25 檢舉
這裡無法貼圖 , 我貼到最上面發文地方
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 個回答

0
sam0407
iT邦大師 1 級 ‧ 2018-01-17 10:46:19
最佳解答

https://ithelp.ithome.com.tw/upload/images/20180117/20012665SZuM4Rc2D7.png
看錯誤訊息看重點,重點已經用紅框框起來了,問題是連不到資料庫。
您資料庫正確的ConnectionString是什麼?換掉範例程式裡的應該就可以了

0
石頭
iT邦高手 1 級 ‧ 2018-01-16 20:14:20

你把Data Source=. 改成 Data Source= 上圖的伺服器名稱那串文字

可參考 : http://marco.easyusing.com/2009/06/data-source.html

我要發表回答

立即登入回答