Very slow app startup when using dll built with VS 2010 - c#

I have a class library project consisted purely of xml files with build action set to Embedded resource. Application reads these files during startup.
When I build this project inside VS 2010, deploy this project to IIS, application starts very slowly ( > 5 min).
When I open same solution with VS 2012, build class library project and deploy dll to IIS, application starts for ~20 seconds.
Inspection of both dll-s with ILSpy didn't find any differences. Also, dlls size is identical. This is profiler trace of slow startup:
Any ideas what could be the cause this issue?
Thanks.

Related

Installing ASP .NET Core service to IIS using Visual Studio Installer Projects

I have a ASP .NET Core 3.1 application which is hosted as a windows service using IHostBuilder.UseWindowsService call. I am preparing a setup project using Visual Studio Installer Projects Extensions. The project is created as Web Setup project type so that the installer dialog already presents to the user selection of web page and application pool on IIS.
The problem I'm facing is that the assemblies are successfully installed in given folder on IIS, but the ApplicationService.deps.json is not installed. Without this file the application does not start successfully. As far as I have checked the file is created as part of the build in bin\x64\Release\netcoreapp3.1\ but is apparently not included by the Setup project.
I've played around also with Setup project's property PublishProfilePath by specify the profile that I generated when manually trying to publish from Visual Studio to IIS:
However, this produces even stranger results. The application is deployed to the IIS already when I build the Setup project! Then when check the newly created msi, it's size is really small and in fact does not install anything (completes successfully though).
Any help would be highly appreciated.
I managed to solve the problem, though I'm not sure if that's the optimal solution. In the setup project, you can include as part of the output also individual files. If I add the ApplicationService.deps.json it is marked with a relative path in the setup project itself. This means that once setup project is being build, the ApplicationService project is anyway built first as it's the primary output of setup project. At that point `ApplicationService.deps.json' is present in the Release folder. Then as msi is being created it's included as part of the output.
It works, but I would prefer that the setup project would include that file automatically.

WPF app not running in different folder

I have developed an app in WPF using VS 2015. I created a release build for this app. But when I copy this build to any other folder outside it starts properly but does not launch API methods i.e. API hitting methods are not being called or my app is not responding. As it runs properly in debug mode I can't find the reason. Can anybody help?
You should to copy ALL dll's from the Release folder. Your exe file is dependent on configuration (yourprogram.exe.config) as well as other assemblies (dll's from your folder). Without these dependencies the application cannot run (because that is how .NET works). All classes and methods are wrapped in dll and if you run your program without some dll, then it means that there are no necessary classes or its methods which worked with other dll's in your Visual Studio.
You can use ILMerge to merge all dependencies into single .exe file to simplify distribution of your application.
More detaiils on ILMerge can be found here: ILMerge on CodeProject

Solution file appears in Target Folder when I publish a website project using File System publish method , in Visual studio 2012

I'm new to dotnet. When I publish a website project in visual studio to a local folder, I see the build & publish are successfull but the solution file also appears in the folder. How to avoid this? Please help me..
The correct answer is to look in the Package/Publish Web settings (in the web application project properties) and look for the "Items to deploy".
For Web application projects, you typically build the project in Visual Studio or by using the ASP.NET batch compiler on a computer that is not the production IIS server. All code-behind class files and standalone class files in the project are compiled into a single assembly, which is then put in the Web application project's Bin folder. (The .aspx and .ascx files are compiled dynamically in a manner similar to what is done for Web site projects.)
For Web site projects, you do not have to manually compile the project. Web site projects are typically compiled dynamically by ASP.NET (on both the development computer and the production IIS server). You can choose between batch compilation mode, which typically produces one assembly per folder, and fixed compilation mode, which typically produces one assembly for each page or user control.

system.dllnotfoundexception without VS 2008

My C# code loads a C++ DLL. It works fine on my PC, where Visual Studio 2008 is installed. But on other machines the program stop with an exception
Unhandeled exception: system.dllnotfoundexception unable to load dll ...
this application has failed becasue the application configuration is incorrect....
How can I make this code run on a machine that doesn't have VS 2008 installed?
You must distribute your DLL along with your project if it is a custom DLL of yours. If not, you must install the required DLL either with a custom installer or if it is from a different provider, a installer of them.
This post might be a bit older, but
DLL Files And .NET ClickOnce Deployment
I want to deploy one of my .NET apps as a ClickOnce application. The issue is that I am connecting to Oracle (see previous posts here and here). Connecting to Oracle requires at least, 4 DLL files that generally have to be in the same directory as the EXE file. The issue is that when the program is published, the DLLs are not referenced in any way, so the program won’t work.
Then I read about adding the files to the project, so that ClickOnce and the Publish processor will figure out that the DLLs are required and add them to the manifest.
Here is the process in Visual Studio 2005:
1. Put the 4 DLL files in their own directory in your solution directory (for ease of use mostly).
2. Add all four files to your project by going to “Project->Add Existing Item…”
3. Click on each DLL file in the solution explorer and then change their property: “Copy To Output Directory” to “Copy Always”.
That’s it! Now when I publish or even run the application I don’t have to worry about if the DLL files are where they should be.
in vs 2008 on project:
Properties>c/c++ >Runtime Library > choose: Multi-threaded Debug (/MTd)

Merging deployment of a mix of project types in .NET

I am using VS 2008 / .NET 3.5
I have the following mix of projects that makes up our product:
A number of backend c# class libraries
5 windows services
4 Web application projects
I have an MSBUILD proj.xml that lists all the .sln files for each of the above in the correct order and I can build everything in one hit. However when it comes to deployment, I currently publish each web application from VS2008 and then have to manually install each service. In addition there are some configuration files and other bits that I need to copy to the server every time which is a pain.
Is there a way to merge all the above deployment operations into a single project which would automate the deployment process?
Take a look at WebDeploy. Although we use it from within TFS, it will do what you need from a batch file.
http://www.iis.net/downloads/microsoft/web-deploy

Categories