WPF application slow on startup

后端 未结 5 1901
说谎
说谎 2020-12-24 02:41

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 t

相关标签:
5条回答
  • 2020-12-24 03:20

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

    0 讨论(0)
  • 2020-12-24 03:30

    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.

    0 讨论(0)
  • 2020-12-24 03:32

    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".

    0 讨论(0)
  • 2020-12-24 03:40

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

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题