In order to run sql server 2008 express on my dedicated server (Windows Server 2008) I had to install the .net framework 3.5 sp1.
Unfortunately : I have an issue with almost all my websites that appears only with the combination of IIS7 and .net 3.5 sp1 (it's running well on my pc with the Visual Studio webserver).
Whenever my website is using the drawingvisual.renderopen function, I have the following exception:
[COMException (0x80070018): The program issued a command but the command length is incorrect. (Exception from HRESULT: 0x80070018)] System.Windows.Media.MediaSystem.Startup(MediaContext mc) +358 System.Windows.Media.MediaContext..ctor(Dispatcher dispatcher) +454 System.Windows.Media.MediaContext.From(Dispatcher dispatcher) +80 System.Windows.Media.Visual.VerifyAPIReadWrite() +20 System.Windows.Media.DrawingVisual.RenderOpen() +13 QuentezDownloads.Images.GetFileImageThumb(String ImageHash) in E:\Visual Studio 2005\Projects\QuentezMainSite\QuentezDownloads\Code\Images.vb:317 QuentezDownloads.Image.ProcessRequest(HttpContext context) in E:\Visual Studio 2005\Projects\QuentezMainSite\QuentezDownloads\Handlers\Image.vb:27 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
Just a quick FYI - WPF doesn't officially support running as a service (as I believe is happening here when running with IIS, please correct me if I'm wrong). It may have worked in the past, and may sometimes work now, but we aren't actively testing this
setup, and I would discourage you from using it since it may fail randomly. We are working on getting this documented better, since I don't know if we've clearly communicated this broadly.
If you were using WPF as a managed wrapper for WIC, you should instead be able to call into WIC directly and I don't believe you would encounter any side effects under IIS.
That makes sense but this change affects our Continuous Integration environment. We use TeamCity to build our application and run unit tests. We write extensive unit tests against both our model and UI. Where in the past we were able to run these tests on both
our development machines and the build server, they now only run correctly on on our desktops. TeamCity runs as a service which is why we're seeing this problem. We're looking for a workaround so we can begin using SP1. Unfortunately if it means changing our
CI environment, we would have to hold off on the upgrade until next year. (We've already tried some workarounds like changing the user account the TC service runs under as well as allowing it to interact with the desktop). As far as I can see with the unit
tests, they fail consistently with the same error. Any help to get this working is appreciated.
thanks for the speedy reply. I guess I'll have to switch everything over to GDI+, and convert all my XAML clip-art to PNGs.
I must say I'm really disappointed that WPF in a batch/server environment is now dead - there are so many uses it could have been put to. If you'd like to see what we were using WPF for, have a look at:
http://www.easyas123web.com
(You don't need to sign-up or anything). Once a user has created a website, one of the editing facilities we support is to edit images - and depending on the theme you choose, you'll be able to see that we support vector clip-art, shaped images, photo-frame
effects, etc, all server side. Losing the easy vector capabilities (using XamlReader) and replacing them with fixed-res PNGs will be very unfortunate.
I understand that using all WPF features in a server environment might not be possible (eg the new effects), but given that the reason it no longer works appears to be just a coding error (perhaps a badly-formed COM/unmanaged call), surely this could be
added as a supported scenario with minimal effort to yourselves?
Ah well, I guess I'd better make a start on replacing the new tech with the old :-(
This has sparked an internal discussion and we're going to see if it would be feasible for us to begin supporting / testing WPF running as a service. At the very least, we are going to try to fix the issue that regressed the scenarios you guys are hitting.
I will keep you posted as this develops.
This has sparked an internal discussion and we're going to see if it would be feasible for us to begin supporting / testing WPF running as a service. At the very least, we are going to try to fix the issue that regressed the scenarios you guys are hitting.
I will keep you posted as this develops.
David, that would be awesome! Thanks for the help with this.
We are using the Windows Imaging Components via the .NET interface to store images in the HD Photo / Windows Media format to reduce space and bandwidth and then use it for image manipulation to allow custom photo cropping and adding affects such as frames,
nameplates and logos etc...
It would be disappointing to have to go back to the GDI way of doing things so if WPF could be convinced to execute under IIS or as a service it would be great.
We are not using WPF with IIS, but we are certainly using WPF as a rendering engine which runs within a Windows service (which in turn runs a WCF service).
This problem is nothing short of a disaster for us. We are unveiling our product in a couple of weeks, and have deployments soon after that. I am now faced with re-writing a complex rendering engine, comprised of a large amount of geometry, various brushes,
very complex text rendering, and so on, in GDI+ or some other technology, instead of focusing on the many other things that we need to get done before then.
All of our code used to work beautifully as a service, and of course it still works when the service code is instead run as a console application. And even now all of our rendering code is working in a service scenario, except for one line:
This fails with the error “The program issued a command but the command length is incorrect. (Exception from HRESULT: 0x80070018)”.
If I change this to “DrawingContext drawingContext = drawingGroup.Open();” then our rendering code works again, up until the point where we need to turn the DrawingGroup into a BitmapSource using RenderTargetBitmap.
We use the code at
http://forums.msdn.microsoft.com/en-US/wpf/thread/c1a1f56e-e552-452d-985c-2fb801c01bf6/ to do this conversion (minus step 4) – perhaps there is another way?? Basically this approach fails when we try to create the System.Windows.Controls.Image object, and
the way to solve that is to launch a separate STA thread and have the conversion code in there. But this just results in more confusion, and leads into another threading problem.
This is all getting very cumbersome, launching extra threads and adding extra rendering steps to something that needs to work very quickly; generally it’s making a mess of things! I know it works in principal because during my testing I was able to get a
single image back to the client this way before things went haywire with the extra threads, but the rendering was all wrong and out of proportion due to using a DrawingGroup instead of a DrawingVisual. So even if I got this solution working on a realistic
timeline, I’d still have my work cut out for me to get it looking right.
Our product relies on SQL Server 2008, which installs .NET Framework 3.5 SP1 as a prerequisite, so I don’t see how we can get around this issue in the short term. Unless we can uninstall .NET Framework 3.5 SP1 and still have SQL Server operate as normal?
I have already tried many, many things to fix this (running the services with different users and permissions, allowing interaction with the desktop, launching the console app from the service, running the console app as a service using “Exe To Service”,
using different threads for the rendering, targeting a different .NET framework in Visual Studio 2008, etc). Possibly we could host the WCF service in a web server other than IIS? Or re-write it somehow using WIC? Or possibly redo the entire thing in GDI+?
Or maybe there’s some way to use WPF operations to “paint” to a GDI+ surface? I’m really clutching at straws here. The best I have come up with so far is to set up Windows Server to auto-login and then automatically run a console application, but obviously
this is not a long-term solution.
I’m VERY interested to hear what you come up with David!!
quentez
Member
70 Points
20 Posts
Issue with IIS7 and .net framework 3.5 sp1
Aug 03, 2008 11:14 PM|LINK
Hi folks.
In order to run sql server 2008 express on my dedicated server (Windows Server 2008) I had to install the .net framework 3.5 sp1.
Unfortunately : I have an issue with almost all my websites that appears only with the combination of IIS7 and .net 3.5 sp1 (it's running well on my pc with the Visual Studio webserver).
Whenever my website is using the drawingvisual.renderopen function, I have the following exception:
intesoft
Member
561 Points
114 Posts
Re: Issue with IIS7 and .net framework 3.5 sp1
Aug 11, 2008 08:24 PM|LINK
I don't have an answer but have just upgraded to .NET 3.5 SP1 and am now seeing the same thing. [:(]
ASPAccelerator.NET - Fewer bytes, faster pages
ASPRedirector.NET - Put friendly URLs on your site
stusmith
Member
6 Points
3 Posts
Re: Issue with IIS7 and .net framework 3.5 sp1
Aug 12, 2008 12:53 PM|LINK
Aaaargh! Me too. Looks like any attempt to use WPF under IIS fails horribly.
Anyone at MS aware of this?
stusmith
Member
6 Points
3 Posts
Re: Issue with IIS7 and .net framework 3.5 sp1
Aug 12, 2008 04:23 PM|LINK
I've opened a Connect feedback item for this one:
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=361469
I'll also see if I can get any help via my MSDN subscription tomorrow.
David Teitle...
Member
10 Points
5 Posts
Re: Issue with IIS7 and .net framework 3.5 sp1
Aug 12, 2008 08:36 PM|LINK
Just a quick FYI - WPF doesn't officially support running as a service (as I believe is happening here when running with IIS, please correct me if I'm wrong). It may have worked in the past, and may sometimes work now, but we aren't actively testing this setup, and I would discourage you from using it since it may fail randomly. We are working on getting this documented better, since I don't know if we've clearly communicated this broadly.
If you were using WPF as a managed wrapper for WIC, you should instead be able to call into WIC directly and I don't believe you would encounter any side effects under IIS.
Thanks!
David
dochsu
Member
2 Points
1 Post
Re: Issue with IIS7 and .net framework 3.5 sp1
Aug 12, 2008 10:33 PM|LINK
stusmith
Member
6 Points
3 Posts
Re: Issue with IIS7 and .net framework 3.5 sp1
Aug 13, 2008 10:03 AM|LINK
Hi David,
thanks for the speedy reply. I guess I'll have to switch everything over to GDI+, and convert all my XAML clip-art to PNGs.
I must say I'm really disappointed that WPF in a batch/server environment is now dead - there are so many uses it could have been put to. If you'd like to see what we were using WPF for, have a look at:
http://www.easyas123web.com
(You don't need to sign-up or anything). Once a user has created a website, one of the editing facilities we support is to edit images - and depending on the theme you choose, you'll be able to see that we support vector clip-art, shaped images, photo-frame effects, etc, all server side. Losing the easy vector capabilities (using XamlReader) and replacing them with fixed-res PNGs will be very unfortunate.
I understand that using all WPF features in a server environment might not be possible (eg the new effects), but given that the reason it no longer works appears to be just a coding error (perhaps a badly-formed COM/unmanaged call), surely this could be added as a supported scenario with minimal effort to yourselves?
Ah well, I guess I'd better make a start on replacing the new tech with the old :-(
Regards,
Stu Smith
David Teitle...
Member
10 Points
5 Posts
Re: Issue with IIS7 and .net framework 3.5 sp1
Aug 13, 2008 06:07 PM|LINK
This has sparked an internal discussion and we're going to see if it would be feasible for us to begin supporting / testing WPF running as a service. At the very least, we are going to try to fix the issue that regressed the scenarios you guys are hitting. I will keep you posted as this develops.
Thanks!
David
intesoft
Member
561 Points
114 Posts
Re: Issue with IIS7 and .net framework 3.5 sp1
Aug 13, 2008 10:07 PM|LINK
David, that would be awesome! Thanks for the help with this.
We are using the Windows Imaging Components via the .NET interface to store images in the HD Photo / Windows Media format to reduce space and bandwidth and then use it for image manipulation to allow custom photo cropping and adding affects such as frames, nameplates and logos etc...
It would be disappointing to have to go back to the GDI way of doing things so if WPF could be convinced to execute under IIS or as a service it would be great.
ASPAccelerator.NET - Fewer bytes, faster pages
ASPRedirector.NET - Put friendly URLs on your site
I Am User
Member
8 Points
4 Posts
Re: Issue with IIS7 and .net framework 3.5 sp1
Aug 14, 2008 06:01 AM|LINK
We are not using WPF with IIS, but we are certainly using WPF as a rendering engine which runs within a Windows service (which in turn runs a WCF service).
This problem is nothing short of a disaster for us. We are unveiling our product in a couple of weeks, and have deployments soon after that. I am now faced with re-writing a complex rendering engine, comprised of a large amount of geometry, various brushes, very complex text rendering, and so on, in GDI+ or some other technology, instead of focusing on the many other things that we need to get done before then.
All of our code used to work beautifully as a service, and of course it still works when the service code is instead run as a console application. And even now all of our rendering code is working in a service scenario, except for one line:
DrawingContext drawingContext = drawingVisual.RenderOpen();
This fails with the error “The program issued a command but the command length is incorrect. (Exception from HRESULT: 0x80070018)”.
If I change this to “DrawingContext drawingContext = drawingGroup.Open();” then our rendering code works again, up until the point where we need to turn the DrawingGroup into a BitmapSource using RenderTargetBitmap.
We use the code at http://forums.msdn.microsoft.com/en-US/wpf/thread/c1a1f56e-e552-452d-985c-2fb801c01bf6/ to do this conversion (minus step 4) – perhaps there is another way?? Basically this approach fails when we try to create the System.Windows.Controls.Image object, and the way to solve that is to launch a separate STA thread and have the conversion code in there. But this just results in more confusion, and leads into another threading problem.
This is all getting very cumbersome, launching extra threads and adding extra rendering steps to something that needs to work very quickly; generally it’s making a mess of things! I know it works in principal because during my testing I was able to get a single image back to the client this way before things went haywire with the extra threads, but the rendering was all wrong and out of proportion due to using a DrawingGroup instead of a DrawingVisual. So even if I got this solution working on a realistic timeline, I’d still have my work cut out for me to get it looking right.
Our product relies on SQL Server 2008, which installs .NET Framework 3.5 SP1 as a prerequisite, so I don’t see how we can get around this issue in the short term. Unless we can uninstall .NET Framework 3.5 SP1 and still have SQL Server operate as normal?
I have already tried many, many things to fix this (running the services with different users and permissions, allowing interaction with the desktop, launching the console app from the service, running the console app as a service using “Exe To Service”, using different threads for the rendering, targeting a different .NET framework in Visual Studio 2008, etc). Possibly we could host the WCF service in a web server other than IIS? Or re-write it somehow using WIC? Or possibly redo the entire thing in GDI+? Or maybe there’s some way to use WPF operations to “paint” to a GDI+ surface? I’m really clutching at straws here. The best I have come up with so far is to set up Windows Server to auto-login and then automatically run a console application, but obviously this is not a long-term solution.
I’m VERY interested to hear what you come up with David!!