Click here to Skip to main content
15,845,681 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have created C# console app .Net framework 4.5.2 project which export data from sql server to csv file. Everything works fine from visual studio when I debug the project and also work if I run application.exe file from my PC. But I want to deploy this application on my different server so I copied whole debug folder to server and tried to run exe file but it says program not able to run and close.

What I have tried:

I copied whole project folder also but same result. So I’m confuse what I’m missing.
Posted
Updated 27-Dec-19 3:19am
Comments
Richard MacCutchan 27-Dec-19 8:50am    
That is not the correct way to deploy .NET applications. Use the Settings -> Publish tab to do it properly.

1 solution

We can't tell - there are just too many variables.

But ... the most likely two possibles are that the SQL connection string is wrong, or the output location does not exist / have write permission in the new system.

When you release software, you shouldn't copy the debug folder - create a release build (change "debug" to release on the VS menu bar and rebuild) and release that instead.

Start by adding logging statements to your release code to output to a file and show you how far the app got before failing. Then after is crashes, look at the log and find out what the last log was. Then add more logging code between that and the next log statement iot didn't get to, to "narrow it down". Repeat this including more info of what is going on (variable contents, return values, etc.) until you have a good idea where it's failing - you should be able to work out from there what the problem is, or at least provide code fragments which illustrate the problem.

Sorry, but we can't do any of that for you!
 
Share this answer
 
Comments
RaviP17 27-Dec-19 9:18am    
Thanks a lot. It worked after changing to release from debug.
I will start adding log for future error check.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900