Page view counter

Issue with IIS7 and .net framework 3.5 sp1

Last post 12-19-2008 7:19 AM by BartDeVries. 35 replies.

Sort Posts:

  • Issue with IIS7 and .net framework 3.5 sp1

    08-03-2008, 7:14 PM
    • Loading...
    • quentez
    • Joined on 01-18-2006, 2:02 PM
    • Posts 20
    • Points 70

     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:

    [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
     If someone have an idea, please reply Smile 
     

  • Re: Issue with IIS7 and .net framework 3.5 sp1

    08-11-2008, 4:24 PM
    • Loading...
    • intesoft
    • Joined on 09-20-2002, 2:10 AM
    • Manchester, UK
    • Posts 114
    • Points 561

     I don't have an answer but have just upgraded to .NET 3.5 SP1 and am now seeing the same thing. Sad

    - Simon Green, MCAD,MCSD,MCDBA,MCSA,MCSE



    ASPAccelerator.NET - Fewer bytes, faster pages

    ASPRedirector.NET - Put friendly URLs on your site
  • Re: Issue with IIS7 and .net framework 3.5 sp1

    08-12-2008, 8:53 AM
    • Loading...
    • stusmith
    • Joined on 08-12-2008, 12:51 PM
    • Posts 3
    • Points 6

     Aaaargh! Me too. Looks like any attempt to use WPF under IIS fails horribly.

     

    Anyone at MS aware of this?

  • Re: Issue with IIS7 and .net framework 3.5 sp1

    08-12-2008, 12:23 PM
    • Loading...
    • stusmith
    • Joined on 08-12-2008, 12:51 PM
    • Posts 3
    • Points 6

    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.

  • Re: Issue with IIS7 and .net framework 3.5 sp1

    08-12-2008, 4:36 PM

    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

  • Re: Issue with IIS7 and .net framework 3.5 sp1

    08-12-2008, 6:33 PM
    • Loading...
    • dochsu
    • Joined on 08-12-2008, 10:15 PM
    • Posts 1
    • Points 2
    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.
  • Re: Issue with IIS7 and .net framework 3.5 sp1

    08-13-2008, 6:03 AM
    • Loading...
    • stusmith
    • Joined on 08-12-2008, 12:51 PM
    • Posts 3
    • Points 6

    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

  • Re: Issue with IIS7 and .net framework 3.5 sp1

    08-13-2008, 2:07 PM

    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

  • Re: Issue with IIS7 and .net framework 3.5 sp1

    08-13-2008, 6:07 PM
    • Loading...
    • intesoft
    • Joined on 09-20-2002, 2:10 AM
    • Manchester, UK
    • Posts 114
    • Points 561

    David Teitlebaum MSFT:
    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.

    - Simon Green, MCAD,MCSD,MCDBA,MCSA,MCSE



    ASPAccelerator.NET - Fewer bytes, faster pages

    ASPRedirector.NET - Put friendly URLs on your site
  • Re: Issue with IIS7 and .net framework 3.5 sp1

    08-14-2008, 2:01 AM
    • Loading...
    • I Am User
    • Joined on 08-14-2008, 5:58 AM
    • Posts 4
    • Points 8

    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!!

  • Re: Issue with IIS7 and .net framework 3.5 sp1

    08-22-2008, 6:20 PM
    Gerhard Schneider - MSFT
  • Re: Issue with IIS7 and .net framework 3.5 sp1

    08-28-2008, 7:45 AM
    • Loading...
    • BartDeVries
    • Joined on 08-28-2008, 7:34 AM
    • Posts 5
    • Points 30

    I have looked at the work-around but did not manage to get my app working again(I cannot find how to make my dll or WPF start in XP compatible mode). Anybody else allready got his website up and running again using WPF?

    Regards, Bart

  • Re: Issue with IIS7 and .net framework 3.5 sp1

    08-28-2008, 9:26 AM
    • Loading...
    • intesoft
    • Joined on 09-20-2002, 2:10 AM
    • Manchester, UK
    • Posts 114
    • Points 561

    I have moved any WPF processing out of the website and into a separate service and then call this using remoting (with IPC). This seems to work very well and also gives us scope to move the image processing to separate machine(s) at some point if needed so it's better from an architectural point of view.

    It doesn't appear to use as much memory as it did when running under IIS 7.0 (maybe there was a leak?) and also seems more reliable.

    I don't think it's possible to make IIS 7.0 itself run in XP compatibility mode as it's part of that version of Windows but you have more control over your own service.

    - Simon Green, MCAD,MCSD,MCDBA,MCSA,MCSE



    ASPAccelerator.NET - Fewer bytes, faster pages

    ASPRedirector.NET - Put friendly URLs on your site
  • Re: Issue with IIS7 and .net framework 3.5 sp1

    08-28-2008, 10:08 PM
    • Loading...
    • I Am User
    • Joined on 08-14-2008, 5:58 AM
    • Posts 4
    • Points 8

    The workaround worked for us! But we're not using WPF with IIS, only in a normal Windows service.

    Ultimately, though, this functionality should be added back into the framework and properly tested at Microsoft, because it always used to work just fine (up until .NET 3.5 SP1 was released), and it makes a great off-screen rendering component.

    As a side note, it would also be nice if the Color and BitmapSource classes (amongst others) were serializable, so they could be transported over WCF without having to convert them into other structures such as byte arrays.

  • Re: Issue with IIS7 and .net framework 3.5 sp1

    08-28-2008, 11:06 PM

    I can confirm that we are trying to fix this particular issue.

    Gerhard Schneider - MSFT
Page 1 of 3 (36 items) 1 2 3 Next >