I have developed an ASP.NET website that uses System.Windows.Media dlls to render a 3D Image as a bitmap.
The process is the client page requests a render.
The server then runs the Rendering code and sets the bitmap on the page.
This all works fine in VisualStudio, but as soon as I publish to IIS the rendered image no longer displays. The Bitmap rendered by Media3D is empty!
I am using RenderTargetBitmap to Render the ViewPort3d to a Bitmap.
I believe this is an IIS trust issue but I have been unable to solve it. Does anyone have a clue on how to work around this?
I am using .Net 4.5 and am running on Windows 7 64 bit, but the server that will be hosting it is Windows 8 Server, if that changes anything.
UPDATE
Process Monitor was very usefull.
From what I can tell
HKCU\Software\Classes\CLSID{AC757296-3522-4E11-9862-C17BE5A1767E}\Instance
HKCR\CLSID{AC757296-3522-4E11-9862-C17BE5A1767E}\Instance NAME NOT FOUND
HKCU\Software\Classes\CLSID{2B46E70F-CDA7-473E-89F6-DC9630A2390B}\Instance NAME NOT FOUND
HKCR\CLSID{2B46E70F-CDA7-473E-89F6-DC9630A2390B}\Instance NAME NOT FOUND
These keys could be causing the problem, but i'm not entirely sure what they are, googling the first one comes up with
http://msdn.microsoft.com/en-us/library/windows/desktop/ee719879%28v=vs.85%29.aspx
Which refers to Encoder-Specific Registry Entries. Which leads me to believe I am somehow missing the appropriate encoder/decoder for RenderTargetBitmap and BmpBitmapEncoder to work properly from w3wp.exe/ IIS. Where do I find these? I would of thought they came with .NET Framework. Any clues?
These are not requested when I run the website from Visual Studio...
Thanks,
GP
Related
I am new to ASP.NET and trying to get the debug feature working so I can see the values from the variables in the code. I know that I have done it all wrong from the beginning so the debug is not working properly now. Here is what I did.
A while ago, I played around and built a number of ASP.NET pages, kind of manually creating the .ASPX page and then the code behind page .ASPX.VB directly from the web server. Everything is working fine. I have my desktop computer connected to the Web server, and mapped the directory contains all the web pages (including both classic ASP and ASP.NET), where I just right-click on the web page file and edit directly.
Now, I am updating some ASP.NET pages, and want to learn how to perform debug, but getting many errors when I put the breakpoint and run Debug. Example of errors like "AjaxControlToolKit.Dll not found". Note that the page is still working fine if I view it from the browser, so the AjaxControlToolKit is there.
Can you please suggest the correct way that I should do to retain all the ASP.NET pages and also make the Debug feature working correctly? I have no problem to migrate all web pages from the web server to my local drive (desktop) if that requires for the Debug to work properly.
Thanks in advance,
Frankly you've got an uphill battle ahead of you - it's probably not debugging because the <assembly name>.pdb files are not in the BIN folder of your website, or if they are they are out of date (compared with the source files) or point to the wrong location (of the source files).
IMHO I think you should create a fresh web project in VS and then recreate each page in VS and copy the appropriate code. I think that would be quicker and less risky. The road you're currently heading down will take you on a tour of debugging which would be useful, but not necessary at this point in your learning.
Typically most people develop locally in VS and then use the Publish function (in VS) to create a folder you can then upload (manually if need be) to the remote server.
Usually you want to avoid debugging on the production server unless there's a problem specific to it, which isn't present locally.
I have one asp.net application which I debug locally using IIS Express.
I have a setup by which I access it as http//machine-name:port/appname (instead of localhost).
This works smoothly until suddenly out of the blue during debugging I get the message:
Internet Explorer cannot display the webpage
What ever I do, it does not work again until I restart Windows.
Has anyone faced this issue before? Is there a way to fix this without restarting Windows?
I am using Windows 7 with Visual Studio 2010, but this also happens in VS 2012.
EDIT This issue stopped occurring. which leads me to believe this was Microsoft bug which they fixed in one of their updates
Just taking a stab in the dark, since you aren't getting any responses... Try deleting (or even just rename) the applicationHost.config under "My Documents\IISExpress\config", then open VS.net and run your project again. A new IISExpress config file will get generated for you. I have had mine junked up with something in the past, and starting fresh with a new one fixed whatever it was.
I have faced the same issue in a perticular scenario.
It was like, Page_Load event of 1st page contains code to redirect response to 2nd page and Page_Load event of 2nd page contains code to redirect response back to 1st page.
So due to this browser response fell into infinite loop and it shows message: "Internet Explorer cannot display the webpage".
So I'll suggest you to check the response redirection logic which may be causing problem.
If you work with a DI framework like Ninject and you are doing changes on your services dependencies, beware not to generate a circular dependency. When starting up the application you might get this same error.
I'm working on a fairly large ASP.NET web application and I'm taking a big productivity hit when I do work in the interface. I can zip through adding features to the database and API, then I hit the interface and having to recompile and run eats up a lot of my day.
For example if i'm working on a tricky bit that isn't behaving quite right and requires a number of tweaks I'll have to go through multiple [stop/tweak/build/run/log in/navigate back to page] cycles, which really kills my flow and has me staring at the screen with my finger hovering over the hackernews bookmark each time.
I've been fiddling with ways to get around this problem but I haven't improved my situation much. Here's what I've found so far:
visual studio will restart the app frequently when you change static files (js/css/etc), which shouldn't require a restart. If you run VS with IIS express instead this problem goes away.
If I know I have a bunch of messing around to do i'll cut/paste my code into a server script tag on the markup page, run the product, and tweak until it's good, then cut/paste it back. This is annoying because it often requires setting up a number of Imports page declarations and code editing features in ASP.NET files, while better than ever in VS2010, is not as good as in C# files. Plus, it still restarts the app occasionally once enough changes are made.
I can exclude the codebehind file from the web application project, change the "codebehind" attribute in the aspx page declaration to an "src" attribute, then edit the code from there while the app runs (until i make enough changes to trigger a restart.) However now intellisense doesn't work in the codebehind, among other things.
Am I missing something blindingly obvious here, or is development in ASP.NET web applications really supposed to be this slow? Thanks for any solutions you can offer.
I never run my applications through Visual Studio. Set yourself up with IIS and then configure a site to point to the location of your application along with a faux domain. Edit your hosts file to point the domain to localhost.
Then when you want to view your site, just visit the domain that you chose. If you need to modify CSS or script, just make your changes and refresh the page. If you make a code change, compile your app and then refresh the page.
If you need to actually use the Visual Studio debugger, then just attach to the IIS process (application pool name) and your breakpoints will get hit.
I've found a combination of techniques that brings my productivity up a fair bit.
Use an alternative browser like Chrome. When you stop the VS debugger and you're using IE, VS will shut down the browser, but it won't do it with Chrome (or Firefox, or anything else.)
Switched web.config to run in Windows Authentication mode and wrote a quick transparent login routine enclosed in conditional compilation tags (debug only, this feature is not perfect for our production product.)
Now when I'm getting into it I can stop the debugger (which no longer closes the browser,) make code changes, build, optionally start the debugger again, and just hit F5 in Chrome to load the latest. The refresh obviously takes longer since the app has to start up but there's no "run browser/log in/navigate back to the page" task anymore.
Hopefully this will help somebody else in a similar situation.
My company gave me a web application project and I went to debug it and set some breakpoints and they dont fire. I am using Response.Write all over the place to debug. Anyone know what maybe going on?
I am running the application off my localhost I was pushing F5, but since the breakpoints dont hit by making changes and adding Response.Write statements and clicking save then refreshing my browser I get the changes for whatever reason.
Hovering over the breakpoint it says "The breakpoint will not currently be hit the source code differs from the original version"
Another tidbit is I created a new web application project and created a breakpoint and it works, its only specific to this application it seems like, but dont know what it could be?
Hovering over the breakpoint it says "The breakpoint will not currently be hit the source code differs from the original version"
Try this:
Close Visual Studio and make sure any instances of ASP.NET development server are closed as well
Delete everything from "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files" (where v4.0.30319 is the version of your .NET Framework)
Definitely need more info, but I would check that your are building with debugging symbols to cover the dumb stuff.
Okay, after reading the comments posted on your question I was making the following assumptions.
You are running using the built in VS development server
You are compiling in debug mode
You've set debugging true in your web.config
I've seen this problem before and for me it's been resolved by restarting Visual Studio.
Assuming that you are running on IIS on the same machine that you have visual studio installed:
Have you attached to the application pool process
Is you code the same as what is deploy? (Is the latest version deployed)
Are you logged in as administrator?
Are you running visual studio as administrator?
Just to make sure, you are running in debug mode?
I ran into this problem a while ago as well, instead of using response.write, you could try outputting the data to a label control's text value instead to see the values of your code.
It's a bit of a sloppy work around, but I couldn't figure out why that one particular project I was working on didn't let me debug it.
This problem is, for me, mostly caused by a mismatch of the loaded dll files (symbols) by webserver, and those that the project are pointing to when you try to breakpoint. It's different files. I have located different causes. One could be a simple hang-up by webdev instans (force shutdown. But also that there occur some kind of mismatch if you got different compilation methods between project within same solution as the web project.
This desc may not be your exact problem, but perhaps it will lead you into right direction. I find this often being a dirty unlogic error that just are irritating (but also completely fixable without data loss or reconfiguring, when u understand the trick).
I had the same problem, and it turned out only Internet Explorer works with debugging and breakpoints. To avoid having IE as my default browser, I changed the launch settings in the .Web project to run IE with the path as command line parameters.
Trying to print an ASP.NET Charting control behind the scenes in my web app. I think it is a permissions issue with the printer as everything is ok up until the point where my code calls:
chart.Printing.Print(false);
bool finished = false;
while (!finished)
{
finished = File.Exists(settings.GetValue("statusfile")); // file which indicates document was printed
System.Threading.Thread.Sleep(1000);
}
At this point the page just freezes (or continues to load endlessly - infinite loop!) Understandably this is happening because I am 100% relying on the document being printed. I do intend to add a timeout, however, at the moment I am just trying to figure out why exactly the document is never being set to the printer!
I have given the account (which the AppPool is running under) permissions to all the relevant folders and even the pdf printer itself...Still nothing.
Am I missing something? Is there any issues with printing on the server side via ASP.NET? I have encountered some issues doing this via WindowsServices in the past not sure if it is a similar problem with ASP.NET websites.
Update
As suggested I updated the AppPool to give myself (admin) permissions and it is the same issue. So by the looks of things the job is never being sent to the printer. I can't seem to figure out why though...
Probably should have mentioned this in my original post....but I am invoking the printer through a referenced DLL, this code is not being called directly from my application (incase it matters). Also this runs fine on my Development machine which is running Windows 7 IIS7.0 where as the server is running Windows 2003 server with IIS6.0.
Update 2
I removed the while loop and just left in the chart.Printing.Print(false) line and turns out the document IS being sent to the printer. So the issue must be with the settings file not getting written which is why the loop never breaks out!
To isolate if this is indeed a permissions issue, you could try running the application using the Visual Studio web development server, which will run under your credentials. Or if that's not an option, temporarily change the IIS app pool so it uses your credentials. If things still do not work, you may have another issue. I'm not sure which charting library you're using (is it the newish Microsoft one?), but maybe Print wants to show a printer dialog.