0

My requirement is to run a database query and store the output in a file but my application is an ASP.NET MVC application.

I have created a C# program which connects to the database and a getter and setter class for each column in the DB. I want to run this program independently. Is this possible?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
user3715927
  • 113
  • 1
  • 1
  • 7
  • As is, this question is too broad to answer. Independently of what? Do you mean a console application or an ASP.NET MVC application? MVC applications are web apps which run in a web server and, per their name, serve up content. – David L Jun 12 '18 at 03:32
  • I understand that asp.net runs on a server, but I want to run a console app which will write data to a file and that file needs to be manipulated by a module in the asp.net application. How do I achieve this – user3715927 Jun 12 '18 at 15:27

1 Answers1

0

ASP.NET app will not be permitted to write to adhoc locations in file system. You will require impersonation and then granting the impersonated user the rights to the folder.

If you want independence from ASP.NET app, you can write a WCF service which will be hosted in a console app. The WCF service will get triggered from ASP.NET code and then call the DB, get the output and write it to the file system. Make sure the WCF app is hosted in console app and the app is started by a user which has rights over the folder in which the file is expected to be written

NitinSingh
  • 2,029
  • 1
  • 15
  • 33