首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >DataContext System.Security.VerificationException错误

DataContext System.Security.VerificationException错误
EN

Stack Overflow用户
提问于 2013-09-06 22:16:43
回答 1查看 96关注 0票数 0

我正在维护Windows Phone 7应用程序。一切都很好。在WP8上一切正常,但在WP7上应用程序会中断。我在项目中有.sdf数据库。下面是我用来在独立存储中流式传输的代码。

代码语言:javascript
复制
 using (Stream input = Application.GetResourceStream(new Uri("Assets\\myDB.sdf", UriKind.Relative)).Stream)
                    {
                        // Create a stream for the new file in the local folder.
                        using (IsolatedStorageFileStream output = iso.CreateFile("myDB.sdf"))
                        {
                            // Initialize the buffer.
                            byte[] readBuffer = new byte[4096];
                            int bytesRead = -1;

                            // Copy the file from the installation folder to the local folder. 
                            while ((bytesRead = input.Read(readBuffer, 0, readBuffer.Length)) > 0)
                            {
                                output.Write(readBuffer, 0, bytesRead);
                            }
                        }
                    }

                    var listOfCities = ModelUtil.GetCities().OrderBy(c => c.Name);

这是GetCities方法

代码语言:javascript
复制
        public static List<ListPickerData> GetCities()
    {
        List<ListPickerData> cities = new List<ListPickerData>();

        using (myDataContext context = new myDataContext(ModelUtil.ConnectionString))
        {
            var data = context.Cities.ToList();

           ...
        }

        return cities;
    }

这就是它崩溃的地方:

有人知道发生了什么吗?谢谢!

EN

回答 1

Stack Overflow用户

发布于 2013-09-07 18:01:09

尝试从工作的WP8安装中提取数据库文件,然后重新添加到您的项目中。另外,你的连接字符串是什么样子的?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18659961

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档