0
votes

I've deployed a wpf simple application with localdb mdf embeded and entity framework 6, when I test my application at windows 7 the application crash when try access database.

I already installed localdb version 2012, 2014 and netframework 4.7 in this client machine but keeps crashing on query window.

I'm using Visual Studio 2015 Anyone have experiencied this?

dependencies installed in client machine:

  1. net framework. 4.6.1 or above

  2. LocalDB 32BIT\SqlLocalDB.msi or LocalDB 64BIT\SqlLocalDB.msi

Here my appconfig:

<?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" />
    <!-- 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.6.1" />
  </startup>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="System.Data.SqlServerCe.4.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      <provider invariantName="System.Data.SqlServerCe.4.0" type="System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact" />
    </providers>
  </entityFramework>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SqlServerCe.4.0" />
      <add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
    </DbProviderFactories>
  </system.data>
  <connectionStrings>
    <add name="AgroTarifaEntities" connectionString="metadata=res://*/ModelAgro.csdl|res://*/ModelAgro.ssdl|res://*/ModelAgro.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(LocalDB)\MSSQLLocalDB;attachdbfilename=|DataDirectory|\AgroTarifa.mdf;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;"
      providerName="System.Data.EntityClient" />
    <add name="AgroTarifa.Properties.Settings.AgroTarifaConnectionString"
      connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\AgroTarifa.mdf;Integrated Security=True"
      providerName="System.Data.SqlClient" />  
  </connectionStrings>
</configuration>
2
You should try to provide more information. Is there any log or error message? - Pac0
Pac0 no the application only retrieve logs about computer environment, I try to use try catch log a stack trace but it crashs before do you know a tool to debug in client machine without vs environment? - trmarco

2 Answers

0
votes

This is just a hunch, but maybe that connection string is being used as a literal. Try replacing all instances of &quot; with a single quote. Let me know if that works-it may come up in my work down the road.

0
votes

I Fixed the problem installing on windows 7 client ssdt package it's not the best practice... but fixed for the user.

here the SSDT resource page https://docs.microsoft.com/pt-br/sql/ssdt/download-sql-server-data-tools-ssdt?view=sql-server-2017