troubleshooting a website that doesn't give errors - c#

I have an asp.net web forms, web application that I am working on where the user fills out a form that is currently a paper form and we are trying to get it on an ipad. The form is filled out and then using a .net windows form webbrowser control and bitmap library, I take a screen shot of the form and save it to a server on the local network. The applications works 100% of the time when I run it in debug mode out of visual studio 2013, regardless of web browser. As soon as I publish to IIS 7.5 running on the same machine I am developing on to test it out, it stops working. Everything returns 200 codes like it should but the image of the form does not get saved and I get no errors. I added a console property to the class I'm using to create the image of the form that adds statements after each line of code that I then write to the web browser console and all lines of code are being executed. I don't know what to do next to try and figure out why this isn't working. Any suggestions?

My gut tells me this may be a permissions problem. Have you ensured the security context under which your IIS app domain is running as write permissions to the folder in which you are storing the files? In 'debug' mode, your user account may already have permissions, but not so with the IIS security context. You may be getting access denied errors that you are somehow swallowing in your code. Just a hunch. Post more details for better diagnosis.

Related

How can I take screenshots from a background process?

I want to set up a system whereby anyone logged onto a machine on our local network can see what's on the screen of any other machine on the local network. This is part of a peer-monitoring programme, and is with the agreement of all users.
All machines are running Windows 7 or 10. Ideally, I would like it that someone using an iPad could also see the screens.
My initial thought was to install IIS on each machine, and have a web site that would capture the screen and return it on request. That way, a user at another machine could just browse to http://machinename/ and see the screenshots. This would work for desktop machines and iPads.
However, I discovered that you can't access the screen that way, so that idea is out. Similarly, it seems that a Windows service can't access the screen either.
What options do I have? I want something that can be installed once for all users, and show what's on the screen(s) attached to that machine.
Like a lot of similar questions out there, a simple solution requires just some basic understanding of how Windows session isolation works, detailed in posts like this.
As you want to capture screenshots, your code must run in the same user session. Then any sample code you find from search engines will work flawlessly.
Many existing screen capture solutions are built upon this simple approach, and usually have a Windows tray app that launches when a user logs in, which prepares the screen shots by calling the capture API.
You cannot use a Windows service or a web app on IIS to call the capture API, because they run in session 0, not that user session.
Behind the scene, other necessary components are there to dispatch the screen shots to a centralized backend server (so that they can then be sent to the monitoring device).
Note that for this part multiple approaches/architectures can be used, so I won't share too much to restrict your imagination.

Creating Microsoft Word objects in an ASP.NET Application

I have an IIS 7.5 on a 2008 R2 server running an application using ASP.NET with framework 4.0. The application creates a word report, first it opens an HTML web page, selects all of the content and copies it to a word template and then it saves it in a location. If I run the application form Visual Studio Express 2010, the application runs fine and does everything it should. But when I run it from IIS the application hangs. I have the InternetExplorer object and the Word object set to visible so I can see what's happening (normally is set to false), and no Internet Explorer is visible or Word even though I can see in the task manager that the processes are up and running. If I let it run an exception will be thrown that says:
"This command is not available because no document is open"
When the first action is made with the code is a word.ActiveDocument.Select(); this is after word.Documents.Open(); If I put a word.Activate(); before a word.Documents.Open();another exception will be thrown that says:
"Cannot activate application"
our AppPool is set to our local user with Super Admin rights, the folders have both users, the AppPool and the local user, with all rights, I have done the DCOM Setting to defaults and added missing users. I do know that Microsoft advises against Office Automation but for now we are using this.
I guess the problem is with some permissions but I don't know where else to look. Also it's very strange that the applications are set to visible and the processes are shown in the Task Manager to be up and running but not even the IE window is shown.
EDIT :
I will change the code to use OpenXML SDK as all the information that I've encountered and comments leads to this, but I will leave the question open to see if anyone has more information. Also the other part of the question was that the IE Object is created, initialized and the process is up, but no window is visible even though the object is set to visible anyone can shine some light on this?
I'm using the
InternetExplorer Class.

Lightswitch Deployment Issues

I am trying to deploy a lightswitch app via web deployment. This will be a web application. It seems to publish just fine, and after a long period of troubleshooting, a coworker and I were able to finally get an admin user added, but now the site just shows a white screen with "Loading," but nothing else ever happens. We are using .NET 4.0. There is no indication of an error, and we have the trace logs available, but I don't see anything that looks like an error. Does anyone know what might be happening. I am using VS 2012.
Thanks!
If you're Debugging the app locally, and you're using forms authentication, and have the "Application Administrator Already Exists" option selected in Publish settings, you're always taken to the Desktop Client in order to "Setup" administrators. Simply navigate to the HTMLCLient (or whatever you've called it) by typing "http://myapp.com/HTMLClient" into the address bar. This should allow you to use your app, or at least login.

Print file from WCF Data Service

I have a WCF Service Operation that receives an image as a Byte stream, and should print that image locally on the server silently. No dialogs or popups, when the service is called it should send the image to the printer straight away.
I am trying with a local image stored on the server using PrintDocument.Print().
The weird thing is that it works on Visual Studio's integrated development server, but not on IIS 7.5. I have given the app pool admin rights (I'm actually using the identity of the logged on user, which is an admin) but no luck.
From both Visual Studio's server and from IIS I can see the available printers, but when I call the service from IIS nothing happens, and I mean nothing. No error, no exception, no sign of what's going on at all.
I have tried using ProcessStartInfo with Verb = "print" and Verb = "PrintTo" but the same thing happens. Works on Visual Studio but not on IIS.
I have also tried creating a PrintTicket and a LocalPrintServer with PrintSystemDesiredAccess.AdministratePrinter rights but I don't know what to actually do with it, I don't know how to tell it to print an image file.
I know printing can be a tricky task on any language/platform, but is it really that hard to print an image from a WCF Data Service?
OK. Wanna bang my head against the wall now. It was obviously a permissions issue, so
setting the Owner of the printer to the Admin users group (it was set to System) did the trick.
I'm really missing Linux right now :P

run .msi setup file after accessing web site from server to client

I have created a web application in ASP.NET, with C#. I am getting the following message in my browser window when accessing the application:
---------------------------
Windows Internet Explorer
---------------------------
Stop running this script?
A script on this page is causing Internet Explorer to run slowly.
If it continues to run, your computer might become unresponsive.
I researched into the problem and found the following link, which is proposed as a solution to this problem:
http://support.microsoft.com/kb/175500
I want to execute this setup when a client accesses the web site for the first time. How can I run this setup on the client side?
It is not possible to fully automatically run some program from a website as #cHao said, this is what all browsers prevent.
But you may look at ClickOnce deployment, it allows for very fast and easy installation of your program literally in one click.
http://msdn.microsoft.com/en-us/library/t71a733d(v=vs.80).aspx

Categories

Resources