[英]Unhandled exception running an application on Windows XP but works fine on Windows 7
我們有一個將要在使用Entity Framework 6和SQL Server Express的Windows XP上部署的應用程序。
這是應用程序的應用程序配置文件的外觀:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
<connectionStrings>
<add name="Rust" connectionString="Data Source=(ip here).\SQLEXPRESS;Initial Catalog=Rust;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
只要我們更改連接字符串以連接到實際服務器,並且該應用程序在Windows 7上運行,它就可以正常工作。 但是,如果在Windows XP上運行它,則會發生未處理的異常,我們無法跟蹤該異常:
當我們嘗試從數據庫中檢索一些信息時,就會發生這種情況
Task.Factory.StartNew(() =>
{
//here
departments = new ObservableCollection<Department>(this.GetAllDepartments());
});
我們連接到的SQL Server是SQL Server 2012 Express。 數據訪問層上的App配置如下所示:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb"/>
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers>
</entityFramework>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
</configuration>
這是問題所在:
我們一直在使用一個名為VirtualBox的虛擬機,該虛擬機上裝有Windows XP。 我們嘗試安裝Visual Studio 2010並從那里調試應用程序,但沒有成功。 經過兩天的討論,為什么這行不通,我們嘗試使用VMWare工作站,它運行良好!! VirtualBox軟件一定存在某種問題。
謝謝你們的建議!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.