Windows 7 64bit, VS 2012, SQL 2012 localdb, EF 5.0, .net 4.5
I'm developing a new Winforms app using EF code first. I've been following Julie Lermans books and examples for EF, Code First and Dbcontext. Her examples use console applications and I have no trouble getting them to work and create my db. However, when I replace the console app with a forms app using identical code the db is not getting created. The only differenece is that I'm putting the console app Sub Main code in the Form1 load event. With everything else identical I don't see why it isn't working. It must have something to do with the start up sequence in console apps versus forms apps but I can't figure out what to do to make it work. Any help would be greatly appreciated.
Related
Here's the situation: I have an ASP.NET Web Forms application which uses WPF controls for reporting.
Process is the following: Create WPF controls and bind to data -> create image from WPF control -> use generated image to create PDF reports.
I'm using RenderTargetBitmap to render bitmaps from WPF controls. Issue is when I run all this on my local machine (Windows 10) it works, as soon as application is deployed on QA machine (Windows Server 2008 R2) it generates empty images.
I tried to simplify reporting page, by leaving only static text on the WPF control, still I get empty page.
I created sample console application which mimics part of binding data to WPF (granted static data) and generating image from WPF control & it works on both environments. One difference I can think of is the console application is not running as IIS' AppPoolIdentity, which runs the Web Application on the QA machine.
I came across this SO post which suggests there was a Windows Update that caused similar issue. Our QA machine is Azure VM, so updates are installed regularly. Update that caused the issue is from September 2017, having fix update out in October 2017. So I rulled out windows update causing the issue.
Also in the referenced SO post, OP suggests that this issue happens only if account running the code is System account
It ONLY doesn't work if run under high privilege SYSTEM account (e.g. from Task scheduler).
I tried this as well, having Task Scheduler running the sample console app, but as I mentioned above it successfully created the image.
So at this moment I'm pretty much out of ideas.
The application code that is supposed to generate images is scattered so I'm not sharing it here, but if any piece is of particular interest happy to post.
Any idea what can cause this different behavior in diff. environments ?
It turns out ruling out missing Windows Update was not the right thing to do.
At the end I installed the fix windows update and issue was solved.
I've a LoB Silverlight 5 app running on Windows Azure. I developed that app with EF4 and RIA Services. I decided to update the model to EF5 with the latest RIA Services keeping it on .NET 4.
Short story:
after I've updated to EF5 and RIA Services 4.2, the app works locally in the emulator but it crashes on Azure.
Long Story:
App is divided in 4 projects: client, server (contains DbContext), model (contains edmx file), helpers.
When I decided to update, I started with the model project: deleted old references, deleted edmx, added new references (nuget), generated new edmx. It build correctly.
Then the server project: deleted old references, added new references (nuget), changed Domain Service files with DbContext and edited so it works with EF5. It build and the app worked locally (no azure emulator).
When I tested on the Azure emulator the response was a 501. I found somewhere (I post the link when I'll find it again) the solution is to add an app.config file containing the same runtime/assemblyBinding/dependentAssembly/assemblyIdentity section is in the web.config file that references Entity Framework.
Then I uploaded on a staging environment on Azure and the process WaBootstrapper keep cycling trying to install the server code while WaIISHost keep crashing.
Things I tried:
change name to app.config to the server assembly dll eg: AppName.Web.dll.config
delete System.Data.Entity (do not build at all.. that dll is needed);
migrate to .NET 4.5 to get rid of System.Data.Entity;
checking all references in every project and "Copy local" option;
migrate to Entity Framework 6 (RC1).. just trying.. I can't be blamed for it;
(other stuff I don't remember).
None of the list above have changed the results. I spent more that a week on this and now I think I lost focus.. so I'm asking for your help. You, guys, have saved me more than one time. I can't even try to remember how was before internet and StackOverflow.
Thanks.. any help is welcome!
P.S. Edited by the author I forgot to mention I also updated Windows Azure SDK from 1.7 to 2.1.
If you are using spatial data types, they are defined Microsoft.SqlServer.Types. I've read a tweet (from whom I can't remember - sorry) that they had to switch to "copy local" for this type as the Azure image does not contain this file.
I did found this article on code project that highlights this issue in the Background section. Using Spatial Data with SQL Server 2012, Entity Framework 5 and ASP.NET MVC
HTH,
Richard
Installed Visual Studio 2013, opened project, I was asked if I want to update to Windows Azure SDK 2.2: YES. Build. Published. Works.
I really don't know what happend. Anyway my project went beyond that point so I have to migrate to EF 5 and new Ria Services again. If I found out something else I'll edit this answer.
Now a days, I make one application in Silverlight to get Emails from MS Exchange Server online. So first i create Silverlight Application in Visual Studio 2010. Now Issue is that when i add reference Microsoft.Exchange.Webservice.dll to silverlight application so error shown below:
"You cant add a reference to Microsoft.Exchange.Webservice.dll as it was not built against the Silverlight runtime. Silverlight project will only work with Silverlight assemblies".
I have searched error but failed to solve this issue.. please help me..
Silverlight uses a different runtime and a subset of the regular .Net framework, which is why you can only reference other SIlverlight libraries.
I would also think you shouldn't be referencing the Microsoft.Exchange.Webservice.dll directly anyway, rather you should be adding a web service reference to a web service exposed by an existing installation of Exchange, and then using webservice calls to retrieve the emails.
Edit:
This excellent previous StackOverflow should be enough to get you underway: Getting started with Exchange Web Services 2010
I have a web based application developed using MVC 3, Entity Framework 4.0 and SQL CE 4.0. It is used for showing off analysis results and data in charts on a web site. There is little to no data additions from web users in any way.
My second project is part of the same solution and is a basic Win Forms application in C#. Its main purpose is to analyse raw data and update the database for the web site. When I am happy with the system I am likely to automate this part.
I wanted to have a process where I ran the Win Forms based tools to update the database, then deployed the web project to the server, effectively updating the DB on the server.
The problem begins with referencing the Entity Framework objects in the Web App from the Win Forms project. The SQL CE db and Code First implementation of EF 4.0 resides inside the web project. I reference that project from the Win Forms project and for a short time I can use it for development. When I try to build the project and use the Win Forms app the reference goes away and everything fails. I have no idea why this is happening.
Any insight would be helpful.
Doug
I'm trying to use SLQ server compact edition 4 together with entityframework 4.1 with code-first approach in a Windows form application.
In asp.NET MVC there are plenty of tutorials, but I can't find any help for windows form applications.
I did the following steps:
Created a windows form application
Created a new project class library called "library_database"
Created some classes and a DbContext
Created a app.config file in the project and a connection string to a database file with name equal to my DbContext class name
Now when I try to access my DbContext to add a new object, the application hangs and doesn't stop without returning any exception.
How is this possible?
Can you suggest me an approach, tutorial or anything to start?
Consider that I can use EF code-first with asp.NET MVC but I never tried with windows applications
Thanks!
I have this tutorial for WPF - also make sure the catch thrown exceptions when debugging! http://erikej.blogspot.com/2011/02/using-sql-server-compact-40-with.html