WPF application slow on startup - wpf

My WPF application currently only shows a screen with some controls, it doesn't connect to DB or has any other functionality. It's a simple UI screen.
When I was testing in some computers (WinXP SP2), I've detected that it took more than 15 seconds to startup. They were all in our domain.
I've grabbed a similar computer, only with Windows installed, and the application took 2 seconds to startup.
Then I added the computer to our domain, and testing it with a domain user showed that it also took 15 seconds to startup. I tested again with the previous user (local user) and it's still fast. I created another local user, but it takes the 15 seconds that the domain user also takes.
I've added other local users but they were also slow.
To summarize: the application starts fast (2 sec) in only one user, the first one I tested. All other users (domain or local) are slow (15 sec).
I've been checking Improving WPF applications startup time but my problem seems to need a different approach. Does anyone figure out what can be happening?

I found another solution to this problem in this documentation from Microsoft.
Adding the following configuration to the app.config file will also solve the problem:
<configuration>
<runtime>
<generatePublisherEvidence enabled="false"/>
</runtime>
</configuration>
This way, you don't need to change computer configurations. It's just configuration of the application.
UPDATE:
Seems that .NET 4.0 fixed this issue, as documented here on MSDN.

Is the system connected to a network, but cannot reach the internet because the proxy is not configured? If so, go to Internet Settings (i.e. Internet Explorer Properties), Advanced, and look in the tree view for Security and a checkbox like "check revoked certificates" or something (I'm using German Windows, so I don't have the English label at hands). Uncheck and test again.
If this fixed the problem, you have one signed assembly that is not from Microsoft for which the .NET Framework will check for revocations, and time out after 15 seconds. If you disable the checking or configure the internet connection properly, you won't have to wait.

Does it open up a file or interact in the network in some way? Because if not, I would suggest that whether or not you're logged into a domain or running as a local user is probably a red herring.
Are you building in debug or release mode? It's worth trying release mode if you've not already because running in debug does a load of extra error checking..

Have you checked if there are any domain policies that can affect this scenario?

I had still this Problem (.NET 4.5). I my case the problem was, that the computer was not connected to the internet, but there were some other device (cameras etc.) which were connected via GigE. The startup of every .NET Application was delayed for about 20 seconds.
The solution was quite easy: Just connected the computer once to the internet, started any .NET application (first startup took about 7 seconds) and after that, every startup was quite fast, even if the computer was no longer connected to the internet. In addition I had to disable the protocol TCP/IP V6 (caused 3-5 seconds delay).
Another possible solution is to select Properties for the "internet Protocol Version 4 (TCP/IPv4), then select Advanced, select the tab "WINS" and set "Disable NetBIOS over TCP/IP".

Related

WPF Windows 7 VERY Slow to start

I am a solo developer at a small company. Recently, we undertook a complete re-write of all of our U.I.'s for configuring our windows service which is our core product. I'd been developing primarily for windows 8,8.1, and 10. We had seen no issues and the U.I. looks great. When deploying any of the applications to a windows 7 X64 with identical hardware as the other boxes we've used to test, we are seeing a near 30 second startup time when opening any application written in WPF dot net 4.5, regardless of complexity or lack there of (literally the same problem exists when showing a WPF form with nothing on it, just a blank form). This is extremely disheartening, as this makes them un-usable because one of these apps is a custom credential provider U.I. which is unreasonable to ask a user to wait that duration for the U.I. to be shown so they can log in.The other configuration utilities have this slow load time when running in user space so i do not believe it has to do with being launched from the credential provider COM object we've written. Can anyone shed some light on this issue please? I really don't want to go back to win forms because we really like the new look and feel that WPF provides. Is there some patch, update, or trick we can use to get a machine with plenty of horsepower to behave like its 8&10 counterparts?
All machines are identical i7 3.47 Ghz dual core with 8 gig of ram; which should be PLENTY sufficient.
UPDATE: Installing .net 4.7.2 has drastically sped up the launching from about 30 seconds to about 6 seconds. Still not acceptable, but on the right track i guess.
Thanks in advance.
I have put my windows 7 box onto the the internet, installed ALL updates, and installed .net 4.7.2 and it seems to have fixed the issue. Thanks for the suggestions.

Adobe Experience Manager WorkBench Check out/in Issue

Shortly I ve Windows Server 2012 R2, AEM Forms(6.2), SQLServer(2014) and Workbench(6.2) in same server. At first when i install and configure all of them, i can check out or in my applications from Workbench succesfully. However After my software team executes some scripts at Database, we can not check in/out from workbench. The worst thing when i click check out, workbench gives any error. any log. on event log or server application. It gives nothing and don't do my transaction. I saw at forums some people have same issue but nobody writes solution.
Please if any one knows the solution, share with us. What's wrong with my workbench? what to do fix this issue?
The query that your software team ran turns off security on every single LiveCycle service and makes them run as the system user. This includes the services used by Workbench and is very bad. Some of the services rely on knowing who is logged in to operate correctly. In particular, how can LiveCycle know who has checked in/out a resource if the service always runs as system?
Your best bet is to restore the LiveCycle database - or at least the tb_sc_service_configuration table to be where it was before you ran the script.
If you need to remove security on individual services, you should do it through the admin console, but only do it for your processes. Never do it for systems services unless the Adobe documentation says it is OK.
As JeremyP pointed out, modifying the Adobe database directly is a bad idea. The database should be treated as a black box that is only manipulated by Adobe code (either by doing things in the Adobe tools or making calls to Adobe APIs).
You can either make security changes manually through the adminui (as he indicates, which is the most common way of doing it) or programatically using the Adobe client APIs. See the following links for sample code that uses the APIs:
Removing Security - http://help.adobe.com/en_US/livecycle/10.0/ProgramLC/WS624e3cba99b79e12e69a9941333732bac8-7f35.html
Setting the runAs user - http://help.adobe.com/en_US/livecycle/10.0/ProgramLC/WS624e3cba99b79e12e69a9941333732bac8-7f38.html
My company, 4Point, offers AEM Forms consulting services. We have an in-house Apache Ant library that wraps the code above to automate this (and other) common tasks that are typically required when deploying (and redeploying) AEM Forms solutions. It can be included as part of a consulting engagement.

Selenium script breaks when doing other activities

I am using selenium to automate my application.. My applicaton works on IE only.. I dont have much scope for other browser..
but when my scripts are running if i do other activities like reading mails, or update QC in another window.. Those are breaking my scripts (no such element or no such window..) once in a while (mostly out of 10, 2 to 3 times i am facing this issue). But can not make system idle till my scripts are run as i do have other activities after started the script. How to stabilize this?? Any one facing these kind of issues??
Running Selenium tests locally using your one and only IE browser does come at the cost of having to not touch your mouse or keyboard during test executions. A way to get around this is to create one or more virtual machines. VirtualBox from Oracle is a popular choice but there are others. You need to install an operating system on your new virtual machine and odds are that your existing Windows license is single use. You can request an additional Microsoft Windows OS license from your IT department or simply buy one yourself for, what? $190? I have done that when the paper work at my client was unmanageable. My time is worth more than that.
Another alternative is to take advantage of 90 day free licenses from Microsoft.
Start your test on the virtual machine then change focus back to your desktop to do other work. I have even added code to the end of test logic to beep when the test completes so that I know when to expand my virtual machine.
Update
You should add an antivirus to that virtual machine. Safety first. :-)
Selenium does not support and non web-based applications, it only supports web based applications.
So if you are doing activities like reading mails and update QC in other window, you will not able to find the elements through selenium.
If you are facing some challenges with IE browser. Please refer this link:https://code.google.com/p/selenium/wiki/InternetExplorerDriver
There are following limitations are given below:
Some limitations of Selenium Automation tool are as follows:
It does not support and non web-based applications, it only supports web based applications.
Its and open source tool so in case of any technical issues you need to rely on the selenium community forums to get your issue resolved.
You need to know at least one of the supported language very well in order to automate your application successfully.
No inbuilt reporting capability so you need plugins like JUnit and TestNG for test reports.
Lot of challenges with IE browser.

Why can't I use a UI component (Windows form) inside of a Windows service?

I've seen several posts that essentially state that UI components shouldn't run as a service. I understand the rational that no one can respond to UI events etc. But the fact remains that are are many automation tasks that are only possible with Windows forms.
Here is a couple of great examples:
I would like to build a url crawler
service that makes thumbnails of
webpages. Currently the only way I
see to achieve this is to try and
automate the .Net WebBroswer
component.
Automate the printing of MS-Word
docs.
Pre-Vista there was some tricks to get around this, but now there is none. My question is why is this the case, and what alternatives does one really have?
Lookup Shatter Attacks and Session 0 Isolation Feature.
Basically if two processes (of different users) share the same desktop, one process can potentially execute whatever code it wants in the other process by sending windows messages, and this was called a Shatter Attack.
There was a lot of discussion whether this was a design bug or not, and post Vista, Microsoft decided to remove any interactive desktop support for services as that was a potential security hole.
As an alternative, you can consider, running your image generation/printing code as a logged in user, who has access to an interactive desktop.
Like Moron said best thing to do is not run it as a service.
But perhaps you're stuck running it from a service anyway, because there is an existing framework of some sort that you're needing to run your code from.
So the workaround to that would be to write a server program that runs as a logged in user. You will hit that server program from your code the must be in a service. The server will do the work and return the results.
You can communicate between the 2 using WCF over named pipes as the transport, or whatever works. If that doesn't, you can use bare named pipes, or, tcp/ip on the localhost. Judging from your website in your userprofile, you should know all about localhost!
Technically, UI components requires started Windows Message Queue to work. You can run it from windows service (may be with allowed Interaction with Desktop, as far as I know this feature is disabled in Windows Vista and higher).
But things you are talking about is not UI components, it is COM components, and you can use it. At least MS Office, but it is not recommended by Microsoft, because memory leaks are possible. Latest MS Office has server edition, that can be used in application without user interface.

Service Unavailable in IIS

When I access a wrong call to a sql server data into my application in classical ASP I get this message in my entire site: Service Unavailable. It stopped. My site is in a remote host. DonĀ“t know what to do. What can I tell to the "support team" of them to fix that?
If you check out Administration Tools/Event Viewer - Application log you will probably see an error message.
This should give you more information as too why the application pool died or why IIS died.
If you paste this into your question we should be able to narrow things down a bit.
Whenever there are a number of subsequent errors in your asp.net page, the application pool may shut down. There's a tolerance level, typically 5 errors in 10 mins, or so. Beyond this level, IIS will stop the service. I've run into a lot of problem due to this error.
What you can do is either fix all your websites (will take time), or increase the tolerance level or just disable the auto shutdown system. Here's how
Run IIS
Right click on the node 'Application Pools' in your left sidebar.
Click on the tab 'Health'
Remove the check on 'Enable Rapid Fail Protection'
or change the tolerance level.
Hope that helped.
One reason you can get this is if the application pool has stopped.
Application pools can stop if they error. Usually after 5 errors in 5 minutes IIS shutsdown the AppPool. It is part of the Rapid-fail protection and it can be disabled for an AppPool otherwise the AppPool has to be restarted every time it happens.
These settings can be changed by the IIS administrator. It looks like you can setup a script to restart and app-pool so you should be able to set up a new web application (in a different app-pool) to restart your closed app-pool. Hoster might not like that though.
Best result for you would be to catch all the exceptions before they get out into IIS.
Could be a SQL exception in your Application_Start (or similar) method in Global.asx. If the application (ASP.NET worker process) can't start, it can't run, so the worker process has to shut down.

Resources