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

时间:2015-06-09 08:44:48

标签: c# windows sql-server-2012-express

我们有一个将在使用Entity Framework 6和SQL Server Express的Windows XP上部署的应用程序。

以下是应用程序的app配置文件的外观:

/somedir/mysql-5x/bin/mysqld --basedir=/somedir/mysql-5x/

每当我们更改连接字符串以连接到实际服务器并且应用程序正在Windows 7上运行时,它可以正常工作。但如果它在Windows XP上运行,则会发生一个我们无法追踪的未处理异常:

当我们尝试从数据库中检索一些信息时会发生这种情况

public class test {
    public static void main(String[] args) {
        Long a = getValue();
        Long b = getValue();
        Long c = sum(a, b);
    }

    private static Long getValue() {
        return null;
    }

    private static long sum(final long... values) {
        long sum = 0L;
        for(final long value: values) {
            sum += value;
        }
        return sum;
    }
}

我们连接的SQL Server是SQL Server 2012 Express。以下是数据访问层上App配置的外观:

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

1 个答案:

答案 0 :(得分:0)

以下是问题所在:

我们一直在使用名为VirtualBox的VM,其上安装了Windows XP。我们尝试安装Visual Studio 2010并从那里调试应用程序但是没有成功。经过两天的讨论,为什么这不起作用我们尝试使用VMWare工作站,它工作得很好!! VirtualBox软件必定存在某些问题。

谢谢你们的建议!