2012-09-01 33 views
16

Trong dự án của tôi, tôi sử dụng SQL CE cơ sở dữ liệu 3.5 với khuôn khổ tổ chức và sau đó this article nhưng tôi có ngoại lệ này:Không thể tải các thành phần có nguồn gốc của SQL Server Compact tương ứng với nhà cung cấp ADO.NET

Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8080. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details.

Tất cả chi tiết

System.Data.SqlServerCe.SqlCeException was unhandled 
    Message=Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8080. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details. 
    Source="" 
    HResult=-1 
    NativeError=-1 
    StackTrace: 
     at System.Data.SqlServerCe.NativeMethods.LoadNativeBinaries() 
     at System.Data.SqlServerCe.SqlCeConnection..ctor() 
     at System.Data.SqlServerCe.SqlCeProviderFactory.CreateConnection() 
     at System.Data.EntityClient.EntityConnection.GetStoreConnection(DbProviderFactory factory) 
     at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) 
     at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName) 
     at DAL.OimDBEntities..ctor() 
     at DAL.OimRepository..ctor() 
     at Microsoft.Rtc.Collaboration.Sample.SubscribePresenceView.UCMASampleSubscribePresenceView.Subscribe() 
     at Microsoft.Rtc.Collaboration.Sample.SubscribePresenceView.UCMASampleSubscribePresenceView.Run() 
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) 
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
     at System.Threading.ThreadHelper.ThreadStart() 
    InnerException: System.DllNotFoundException 
     Message=Unable to load DLL 'sqlceme35.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) 
     Source=System.Data.SqlServerCe 
     TypeName="" 
     StackTrace: 
      at System.Data.SqlServerCe.NativeMethods.GetSqlCeVersionInfo(IntPtr& pwszVersion) 
      at System.Data.SqlServerCe.NativeMethods.LoadValidLibrary(String modulePath, Int32 moduleVersion) 
      at System.Data.SqlServerCe.NativeMethods.LoadNativeBinaries() 
     InnerException: 
+2

Vì vậy, bạn có tham khảo bài viết KB 974247 không? –

Trả lời

2

Tôi cũng gặp phải vấn đề tương tự. vấn đề là tôi đã sử dụng lệnh sau đây cài đặt gói EFcodeFirst.SqlServerCompact để có được sqlCE. phiên bản đã được tải về bằng cách quản lý gói là 4.0 và ngược lại trên đĩa cứng của tôi với phiên bản hiện tại là 3.5

tải về phiên bản mới nhất 4.0 từ vị trí sau http://www.microsoft.com/en-us/download/details.aspx?id=17876 đã giải quyết vấn đề của tôi

28

tôi đã nhận lỗi này với một tin cài đặt của SqlServerCE. Tôi đã có một tham chiếu đến System.Data.SqlServerCe.dll trong dự án của tôi, nhưng tôi đã thiếu các dll khác (các thành phần tự nhiên) cần thiết bởi SqlServerCE. "Các thành phần gốc" nằm trong thư mục con x86 và amd64 của thư mục "riêng tư" của SqlServerCE. Bạn cần đảm bảo rằng chúng được sao chép vào thư mục đầu ra của dự án của bạn.

+1

các thư mục này ở đâu? – sports

+0

C: \ Program Files \ Microsoft SQL Server Compact Edition \ v4.0 \ Riêng tư – andy

2

Tôi gặp sự cố tương tự. Tôi đã mở một cơ sở dữ liệu sql khuôn khổ nhỏ gọn và nó đã cho tôi những lỗi sau đây:

Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8080. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details.

Khi nhìn lên bài viết, nó dẫn tôi đến Link sau. Các trích dẫn sau đây giải thích những gì đã xảy ra:

Compact based applications generally program against the Compact ADO.NET provider (System.Data.SqlServerCe.dll). This provider in-turn communicates with the native Compact components. In order to avoid various inconsistencies, a Compact ADO.NET provider of a certain version can talk only to the Compact native components of the same version.

Cuối cùng tôi giải quyết nó bằng cách tải về và cài đặt các gói dịch vụ trong những điều sau link.

1

Bạn sẽ cần phải sao chép các tập tin sau đây và toàn bộ thư mục đến vị trí nơi .exe của bạn đang chạy trên máy chủ của bạn. Tập tin này và thư mục có nhiều khả năng trong thư mục C: \ Program Files (x86) \ Microsoft SQL Server Compact Edition \ V4.0 \ Private

System.Data.SqlServerCe.dll Toàn bộ thư mục amd64 Tôi không chắc chắn những gì được sử dụng từ thư mục amd64, nhưng ngay sau khi tôi sao chép này qua ứng dụng của tôi bắt đầu làm việc. Bạn cũng có thể lấy tệp System.Data.SqlServerCe.dll bằng cách bấm vào nó trong Visual Studio dưới thư mục Tham khảo và sau đó trong thiết lập tab thuộc tính "Sao chép Địa phương" thành True và sau đó khi bạn xây dựng ứng dụng của bạn, tệp đó sẽ nằm trong thư mục phát hành.

Các vấn đề liên quan