简体   繁体   English

未处理的异常在Windows XP上运行应用程序,但在Windows 7上运行良好

[英]Unhandled exception running an application on Windows XP but works fine on Windows 7

We have an application that is going to be deployed on Windows XP that uses Entity Framework 6 and SQL Server Express. 我们有一个将要在使用Entity Framework 6和SQL Server Express的Windows XP上部署的应用程序。

Here's how the application's app config file looks : 这是应用程序的应用程序配置文件的外观:

<?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>

Whenever we change the connection string to connect to an actual server and the application is being ran on Windows 7 it works fine. 只要我们更改连接字符串以连接到实际服务器,并且该应用程序在Windows 7上运行,它就可以正常工作。 But if it is ran on Windows XP there occurs an unhandled exception which we cannot trace: 但是,如果在Windows XP上运行它,则会发生未处理的异常,我们无法跟踪该异常:

It happens when we try to retrieve some information from the database 当我们尝试从数据库中检索一些信息时,就会发生这种情况

Task.Factory.StartNew(() =>
{
    //here
    departments = new ObservableCollection<Department>(this.GetAllDepartments());
});

The SQL Server to which we connect is an SQL Server 2012 Express. 我们连接到的SQL Server是SQL Server 2012 Express。 Here's how the App config on the data access layer looks like: 数据访问层上的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>

Here's what the problem was : 这是问题所在:

We have been using a VM named VirtualBox which had Windows XP installed on it. 我们一直在使用一个名为VirtualBox的虚拟机,该虚拟机上装有Windows XP。 We tried installing Visual Studio 2010 and debugging the application from there but that wasn't successful. 我们尝试安装Visual Studio 2010并从那里调试应用程序,但没有成功。 After two days of banging our heads about why this doesn't work we tried using the VMWare workstation and it it worked fine!! 经过两天的讨论,为什么这行不通,我们尝试使用VMWare工作站,它运行良好!! There must be some kind of problem with the VirtualBox software. VirtualBox软件一定存在某种问题。

Thank you guys for the suggestions! 谢谢你们的建议!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM