2011-02-25 42 views
0

我使用C#表達2010年版提出的Windows應用程序,我用的是SQL數據庫,我soultion內MDF文件和連接字符串中的app.config爲以下狂automaticaly:使用Express Edition 2010與數據庫部署Windows應用程序的問題?

<add name="MainForm.Properties.Settings.FamilyHistoryConnectionString" 
     connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\FamilyHistory.mdf;Integrated Security=True;User Instance=True" 
     providerName="System.Data.SqlClient" /> 

然後當我嘗試使用「發佈」從項目屬性然後選擇setup.exe和其他文件顯示 當我想在我的機器上安裝一遍TI測試這個錯誤發佈項目出現:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box. 

************** Exception Text ************** 
System.IO.FileNotFoundException: Could not find file 'C:\Users\MyComputerName\AppData\Local\Apps\2.0\MDXORHTD.5GQ\JR6MCHOZ.O0K\fami..tion_6534de728ebbf078_0001.0000_070d979a18d3a32b\Relative.xml'. 
File name: 'C:\Users\MyComputerName\AppData\Local\Apps\2.0\MDXORHTD.5GQ\JR6MCHOZ.O0K\fami..tion_6534de728ebbf078_0001.0000_070d979a18d3a32b\Relative.xml' 
    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 
    at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath) 
    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) 
    at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy) 
    at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) 
    at System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Object xmlResolver) 
    at System.Threading.CompressedStack.runTryCode(Object userData) 
    at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) 
    at System.Threading.CompressedStack.Run(CompressedStack compressedStack, ContextCallback callback, Object state) 
    at System.Xml.XmlTextReaderImpl.OpenUrl() 
    at System.Xml.XmlTextReaderImpl.Read() 
    at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) 
    at System.Xml.XmlDocument.Load(XmlReader reader) 
    at System.Xml.XmlDocument.Load(String filename) 
    at Family_History.Form1.FillCombo(DataGridViewComboBoxColumn cmb, String FileName) 
    at Family_History.Form1.Form1_Load(Object sender, EventArgs e) 
    at System.Windows.Forms.Form.OnLoad(EventArgs e) 
    at System.Windows.Forms.Form.OnCreateControl() 
    at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) 
    at System.Windows.Forms.Control.CreateControl() 
    at System.Windows.Forms.Control.WmShowWindow(Message& m) 
    at System.Windows.Forms.Control.WndProc(Message& m) 
    at System.Windows.Forms.ScrollableControl.WndProc(Message& m) 
    at System.Windows.Forms.Form.WmShowWindow(Message& m) 
    at System.Windows.Forms.Form.WndProc(Message& m) 
    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) 
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) 
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) 


************** Loaded Assemblies ************** 
mscorlib 
    Assembly Version: 4.0.0.0 
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100) 
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll 
---------------------------------------- 
Family_History 
    Assembly Version: 1.0.0.0 
    Win32 Version: 1.0.0.0 
    CodeBase: file:///C:/Users/MyComputerName/AppData/Local/Apps/2.0/MDXORHTD.5GQ/JR6MCHOZ.O0K/fami..tion_6534de728ebbf078_0001.0000_070d979a18d3a32b/Family_History.exe 
---------------------------------------- 
System.Windows.Forms 
    Assembly Version: 4.0.0.0 
    Win32 Version: 4.0.30319.1 built by: RTMRel 
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll 
---------------------------------------- 
System.Drawing 
    Assembly Version: 4.0.0.0 
    Win32 Version: 4.0.30319.1 built by: RTMRel 
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll 
---------------------------------------- 
System 
    Assembly Version: 4.0.0.0 
    Win32 Version: 4.0.30319.1 built by: RTMRel 
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll 
---------------------------------------- 
System.Data 
    Assembly Version: 4.0.0.0 
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100) 
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll 
---------------------------------------- 
System.Core 
    Assembly Version: 4.0.0.0 
    Win32 Version: 4.0.30319.1 built by: RTMRel 
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll 
---------------------------------------- 
System.Xml 
    Assembly Version: 4.0.0.0 
    Win32 Version: 4.0.30319.1 built by: RTMRel 
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll 
---------------------------------------- 
System.Configuration 
    Assembly Version: 4.0.0.0 
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100) 
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll 
---------------------------------------- 

************** JIT Debugging ************** 
To enable just-in-time (JIT) debugging, the .config file for this 
application or computer (machine.config) must have the 
jitDebugging value set in the system.windows.forms section. 
The application must also be compiled with debugging 
enabled. 

For example: 

<configuration> 
    <system.windows.forms jitDebugging="true" /> 
</configuration> 

When JIT debugging is enabled, any unhandled exception 
will be sent to the JIT debugger registered on the computer 
rather than be handled by this dialog box. 

我不不知道如何解決它,我不知道如何改變連接條件克客戶機
如果你需要更多的信息來澄清這個問題讓我知道......我 很快需要幫助,請:)

+0

你可以編輯你的問題,因爲我看到它搞亂了那些大字體的瀏覽器......(使用鉻) – 2011-02-25 09:28:35

+0

我認爲現在更好:) – 2011-02-25 09:32:05

回答

1

的錯誤似乎是關於Relative.xml文件,而不是數據庫... 。

你部署這個文件嗎? (發佈時將其包含在內容文件中)。

+0

這個文件是在bin中的項目解決方案「該項目的文件夾「,因此將其與項目 – 2011-02-25 09:40:23

+0

一起部署更好地檢查並進行雙重檢查。該錯誤包含路徑,也許啓動一個資源管理器「作爲管理員」來找到它。 – 2011-02-25 10:22:08

+0

我再次添加Relative.xml,並出現相同的問題,所以我會刪除它,並再次檢查 – 2011-02-25 10:32:43