How to Create a Windows Service Using C# and Visual Studio!

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 พ.ย. 2024

ความคิดเห็น • 236

  • @siavashmehmandoost2198
    @siavashmehmandoost2198 ปีที่แล้ว +7

    Thank you so much! I'm creating a windows service that preforms a function every 8 hours. The problem is it doesn't trigger the function on starting the service. Instead, it works once the 8 hours is passed! I want it to get the function started on starting the service and then wait for the 8 hours to perform it for the second time. I followed the same code in the video with a different functionality.

    • @lemastertech
      @lemastertech  ปีที่แล้ว

      Hi! That sounds cool, it should be simple to modify your time base trigger code to run once on initialization and then every 8 hours after that! In this example I write the time the service was started to the log, you could execute the service once then as well!

  • @RANKAPADI
    @RANKAPADI 8 หลายเดือนก่อน +8

    Thanks a bunch. You just gave what I was looking for. Please keep on posting C# practical problems like this. Thanks again for this lovely video. 💯

    • @lemastertech
      @lemastertech  8 หลายเดือนก่อน +1

      Thanks so much for the super nice comment!! I like developing in C# but this is the only C based video I’ve ever made that actually did well, whereas my Python and arduino ones often do quite well so it’s quite a balancing act of picking which content to make 😂😁

    • @dav3587
      @dav3587 3 หลายเดือนก่อน

      @@lemastertech pleeease continue this series!

  • @victorgilbert2565
    @victorgilbert2565 3 หลายเดือนก่อน +2

    Thia is the best tutorial on C# i've seen in a long time. Please make More C# videos bro. Thank you

    • @lemastertech
      @lemastertech  3 หลายเดือนก่อน

      I would like to! I need to get myself a little more free time haha

  • @ThomasPetter
    @ThomasPetter 11 หลายเดือนก่อน +1

    Wow, that was easy! I decided to use batch files for the install and uninstall commands. Now, I'd like my service to start automatically when I log into windows. Thanks for the quick tutorial!

    • @lemastertech
      @lemastertech  11 หลายเดือนก่อน +1

      Nice!! You’re welcome and thanks for watching!!

    • @dwarikajangid5923
      @dwarikajangid5923 9 หลายเดือนก่อน

      ​@@lemastertech I am using a f drive of my PC in the windows service but it gives an error that the access is denied how can I resolve this error thank you please provide a solution as early as possible

  • @Kppoja09
    @Kppoja09 11 หลายเดือนก่อน +2

    Thanks for this video! I was struggling to create a dummy windows service for one of my test cases, I had not touched windows over last 10 years. This came in super handy! ❤

    • @lemastertech
      @lemastertech  11 หลายเดือนก่อน

      Hey you’re super welcome I’m glad it was useful!!

  • @vladislavkaras491
    @vladislavkaras491 11 หลายเดือนก่อน +2

    I was wondering how to create a Windows service.
    Now I got the answer!
    Thanks!

    • @lemastertech
      @lemastertech  11 หลายเดือนก่อน

      You’re very welcome!! Thanks for watching :)

  • @jairocuevas90
    @jairocuevas90 10 หลายเดือนก่อน +1

    Loved the video! Simple, concise, and easy to digest for someone who is learning (aka myself).

    • @lemastertech
      @lemastertech  10 หลายเดือนก่อน

      Thanks so much for watching and for the nice comment!

  • @tasty6556
    @tasty6556 5 หลายเดือนก่อน +1

    idc what they say about your spelling you are my savior

    • @lemastertech
      @lemastertech  5 หลายเดือนก่อน

      Haha well glad I could help thanks for watching!!

  • @JohnS-x6l
    @JohnS-x6l ปีที่แล้ว +2

    Awesome video man, just subscribed to the channel! If possible, I'd like to see more C# coding on a practical use case in an enterprise like environment. Something basic like an FTP or file drop that executes a notification or something basic of the sort would be great material.
    Looking forward to more content!

    • @lemastertech
      @lemastertech  ปีที่แล้ว +3

      Thanks for watching subbing and commenting!! I would like to do something like that since I do stuff like that for work fairly often! I just need to make sure nothing I make uses any work assets so I’d need to set everything up from scratch on my personal computer!

  • @ojdc9215
    @ojdc9215 3 หลายเดือนก่อน +1

    Really nice tips in the video. Also I would like to see a tutorial of how to do whatever I want with Fn keys for example to open google or to turn off a touchpad if I'm in a laptop.

    • @lemastertech
      @lemastertech  3 หลายเดือนก่อน

      Thanks for watching! I definitely want to do more C based tutorials in the future so I’ll keep that idea in mind!

  • @radek7903
    @radek7903 10 หลายเดือนก่อน +1

    Hi, thanks for this tutorial, it's very clearly and easy to understand. Greetings from Poland :)

    • @lemastertech
      @lemastertech  10 หลายเดือนก่อน

      Thanks for watching and hello to you in Poland!! 😊

  •  ปีที่แล้ว +4

    Super useful and extremely well explained tutorial. Thanks a lot!

    • @lemastertech
      @lemastertech  ปีที่แล้ว +1

      You got it! Thanks for watching!

  • @jacksyan763
    @jacksyan763 หลายเดือนก่อน +1

    Thank you so much~ I have a question is let said if failed when we in command prompt, what should we do?

    • @lemastertech
      @lemastertech  หลายเดือนก่อน

      I am not sure what could be tied to that failing, did you get a specific error code or anything?

  • @waynehawkins654
    @waynehawkins654 4 หลายเดือนก่อน +1

    Thanks for this. Have you made any video that take a Services project and also add a taskbar (right click) icon to go and change things like stop,start,settings?

    • @lemastertech
      @lemastertech  4 หลายเดือนก่อน

      Thanks for watching! I have not made a service like that all my projects have been passive things like listener scripts so far I’m sorry!

  • @Mkvkrishh
    @Mkvkrishh 4 หลายเดือนก่อน +1

    Thank you for this video. This was super easy to follow and came in handy.

    • @lemastertech
      @lemastertech  4 หลายเดือนก่อน

      You’re very welcome thank you for watching!!

  • @bbff2862
    @bbff2862 5 หลายเดือนก่อน +1

    Thank you for this channel. I am trying to transfer data from textfile to remote database by useing service. Do you have any sample code? somthing basic to see how it should be work.
    It would be great to know more about this.

    • @lemastertech
      @lemastertech  5 หลายเดือนก่อน

      Hi so you’re trying to parse data out of a text file into some standard formatted data and store in something like a SQL database? That’s a cool project idea but I do not have any sample code I’m sorry!

  • @ishikim86
    @ishikim86 8 หลายเดือนก่อน +1

    Thank you so much for being super detail. It was so useful

    • @lemastertech
      @lemastertech  8 หลายเดือนก่อน

      You’re very welcome thank you for watching and for the nice comment :)

  • @themortu
    @themortu 4 หลายเดือนก่อน

    Hi LeMaster Tech, thank you very much for posting this. Im not actually a programmer but system administrator and from the side of servers admining i want to say that many admins require to run powershell scripts as exe file and run it as a service. Im sure that many of us and especially me would say thank you if you could make some tutorial of how to include powershell script(more than 100 lines) into C# code and run it is as a service. Many thanks one again.

  • @אילכספי-ש7י
    @אילכספי-ש7י 29 วันที่ผ่านมา +1

    Hey bro! Great video helped me a lot - keep it up!
    I'm working on a C# service that runs continuously and monitors the MobaXterm application. I’ve managed to trigger an executable script every time MobaXterm starts, but I'm struggling to trigger the script once when the workstation is unlocked, and MobaXterm is already running. Do you have any suggestions on how I could solve this?

    • @lemastertech
      @lemastertech  28 วันที่ผ่านมา

      Hi I wish I could help you but I have not done any interfacing with MobaXTerm! And unless you can trigger outbound statuses with it, any sort of listening service would really just be listening for start up/ shut down not really statuses within a service

  • @mkafridi19
    @mkafridi19 ปีที่แล้ว +2

    Thank you for the tutorial.
    I have a Desktop application and a Windows Service. I want both of them in an installable (.msi). Can you make a tutorial about this?

    • @lemastertech
      @lemastertech  ปีที่แล้ว +1

      Hey that’s an interesting one because msi installers follow a lot of the same steps but are a bit more complicated! That would make a pretty good tutorial so I will add it to my future vids to do list!! Thanks for the suggestion!

  • @mosheshahar1408
    @mosheshahar1408 ปีที่แล้ว +1

    Hi, enjoyed your tutorial. I would like to start this service from another application that I write. Can you show how? The next step is to create a service with parameters. Thanks a lot

    • @lemastertech
      @lemastertech  ปีที่แล้ว

      Hello I can add this to my projects list for upcoming videos but it might be a while - you can start and stop a service using command line commands anytime so you could write a program or application to execute those commands. It would be a tough video to make but I can start working towards it - should be some good examples on stack overflow too though!

  • @B18419
    @B18419 7 หลายเดือนก่อน +1

    Thank you for the tutorial, it was simple and easy to grasp. I have a specific doubt to clarify, can we do the same in .net 6, if so could you provide the steps and details of it

    • @lemastertech
      @lemastertech  7 หลายเดือนก่อน

      Hi, I believe the same steps apply but I’ll be honest I haven’t specifically tried this for that application so I don’t want to say anything wrong here!

    • @B18419
      @B18419 7 หลายเดือนก่อน

      ​@@lemastertech Hi, thank you, I tried the same , but I was not able to find Wndows Service project that uses .net core when I am trying to create a new project in visual studio 2022

  • @BryanJia-hm8rr
    @BryanJia-hm8rr 4 หลายเดือนก่อน +1

    Thanks for the video! super clear and helpful. However, I am taking over a windows service written by other people and I got the C# files by decompiling it using dot peek. When I then export it into a visual studio project, there is no "designer files" associated with the C# files, nor the installer. Also, when I tried to add the installer, some namespace are not useable, for example, it shows that System.ServiceProcess does not exist in the namespace. What am I supposed to do in this case?

    • @lemastertech
      @lemastertech  4 หลายเดือนก่อน

      Hi I’m sorry this is way too complex and too many things it could be for me to be able to help you much over TH-cam comments!

  • @ElCidPhysics90
    @ElCidPhysics90 ปีที่แล้ว +1

    Very nice tutorial. One used to be able to create an application, build it, then manually add the service in Services. Is that still possible?

    • @lemastertech
      @lemastertech  ปีที่แล้ว +1

      Hi I believe that is still possible but I prefer using some of the tools that do a good bit of the up front formatting for me!

  • @jacr6819
    @jacr6819 5 หลายเดือนก่อน +1

    Great video.
    Im currently building my own DIY Mouse and i need to create some kind of program, that keeps a serial port open in the background. This way the code on the Arduino mouse knows when the PC is on (serial port is open) or off (serial port is closed).
    As i've never done such in depth windows stuff im stuggeling to open the serial port. The debug output of my Windows service says its running and opening the serial port fine, and once the service is running i can't open the port in arduino IDE anymore (suggesting its acually open) but for some reason my Arduino doesn't register, that its open. The arduino code works well at detecting when i open the Arduino IDE's serial monitor but it doesn't work with the windows service...

    • @lemastertech
      @lemastertech  4 หลายเดือนก่อน

      That’s super interesting but I honestly can’t say I’ve done anything with a windows service communicating with an arduino I always use python when I want pc to arduino interfacing!

  • @thepriestofvaranasi
    @thepriestofvaranasi ปีที่แล้ว +2

    You explained it very nicely! Could you please make a few more videos on services? Like let's say 5 popular windows services or something like that?

    • @lemastertech
      @lemastertech  ปีที่แล้ว +1

      That’s a good idea! I do plan on expanding on windows services soon so I can add that to my upcoming videos ideas!

  • @agusridani3277
    @agusridani3277 6 หลายเดือนก่อน +1

    Very usefull tutorial video with very clear explanation. Thanks Alot

    • @lemastertech
      @lemastertech  6 หลายเดือนก่อน

      Youre very welcome thank you for watching!

    • @gaikwadpremkumar5830
      @gaikwadpremkumar5830 6 หลายเดือนก่อน

      Hey from where should I study windows communication foundation? I'm really confused please guide me brother /sisters 🙏🙏

  • @blueceels1056
    @blueceels1056 5 หลายเดือนก่อน +1

    Hey can you make a video on how to create a windows service for intercepting print jobs, modifying the print job and then sending it to the printer ?

    • @lemastertech
      @lemastertech  5 หลายเดือนก่อน

      Hi thanks for the suggestion! That sounds like a pretty cool project but also fairly niche and I’m not sure if it would help a large audience really!

  • @nikhilkamble5415
    @nikhilkamble5415 7 หลายเดือนก่อน +1

    Very good explained must recommended to watch

    • @lemastertech
      @lemastertech  7 หลายเดือนก่อน

      Thanks for watching!!

    • @gaikwadpremkumar5830
      @gaikwadpremkumar5830 6 หลายเดือนก่อน

      Hey bhavaa from where should I study windows communication foundation? I'm really confused please guide me brother 🙏🙏

  • @Nightingale0711
    @Nightingale0711 7 หลายเดือนก่อน +1

    Thank you so much for this wonderful tutorial. Thats what I was searching. can you please guide me may be with the same service code, that how can I communicate the data/message (bidirectional) between the 2 libraries(Dlls) which are loaded within the same service. Thank you once again.

    • @lemastertech
      @lemastertech  7 หลายเดือนก่อน

      Hey you are very welcome and I’m glad you found it useful! I don’t think I’ll have the time required to do a detailed tutorial or help much on setting up this sort of communicate though I am sorry!

  • @_oly_241
    @_oly_241 ปีที่แล้ว +1

    Great video, but then there is deploying the service where you don't have VS. I would imagine it's just using the SC command or the powershell add service command which would be a great add to this video

    • @lemastertech
      @lemastertech  ปีที่แล้ว +1

      Hi thanks for the comment! I think you're correct you could deploy automatically but I do think most people who could figure out how to follow this tutorial could add the service to powershell themselves most likely but I think you're right it could have been good to tack on here too!

  • @carlesls
    @carlesls 11 หลายเดือนก่อน +1

    This tutorial is awesome. It lacks the next step... How it communicates with a gui application or another service. It is interesting to have a background windows service... But how do you control it in a nice gui way?

    • @lemastertech
      @lemastertech  11 หลายเดือนก่อน +1

      Hi - if you want a GUI for control you probably don’t actually want a windows service - the point of this project is how to create a service that runs in the background, which is what windows services are - if you want a GUI that would be an application instead of

    • @carlesls
      @carlesls 11 หลายเดือนก่อน

      @@lemastertech Thanks for your fast feedback. Let's suppose that you want to change the behaviour of the windows service, instead of logging every 5 sec you want to log every 10 sec, how would you do it?

    • @carlesls
      @carlesls 11 หลายเดือนก่อน

      @@lemastertech I will use namedpipes.

  • @mushrafaltaf
    @mushrafaltaf 11 หลายเดือนก่อน +1

    Wow! Thanks a lot, you explained it so extremely well

    • @lemastertech
      @lemastertech  11 หลายเดือนก่อน +1

      You’re welcome thanks for watching and glad it was helpful!!

  • @marthajsayers8146
    @marthajsayers8146 ปีที่แล้ว +1

    Nice video! I would like to see how to connect to a MS SQL Server in a web service to insert rows of data.

    • @lemastertech
      @lemastertech  ปีที่แล้ว

      That would be interesting! You would want the sql data to be manually entered or processed through like a CSV file in a shared folder or something?

  • @PunisherQc
    @PunisherQc 3 หลายเดือนก่อน +1

    It would be nice to know how to do a Setup for this

    • @lemastertech
      @lemastertech  3 หลายเดือนก่อน

      Hi could you give some more info what you mean by setup?

    • @PunisherQc
      @PunisherQc 3 หลายเดือนก่อน

      @@lemastertech just a setup.exe/.msi to install/uninstall it automatically, without having to push the user to type InstallUtil command himself. I've finally figured it out by looking at many videos so it would be a nice addition for your subscribers. (Using Microsoft Visual Studio Installer Project extension, all the process of "installing" the app itself, then "installing the service" itself by adding Custom Actions at the Install, and Uninstall time)

  • @pavansn6018
    @pavansn6018 6 หลายเดือนก่อน +1

    Can u please explain how to connect sql server to windows service or how to add controller to it. It would be very useful

    • @lemastertech
      @lemastertech  6 หลายเดือนก่อน

      Hi sql has pretty good documentation on how to do that on mssql documents online!!

    • @pavansn6018
      @pavansn6018 6 หลายเดือนก่อน

      Ok thankyou

    • @pavansn6018
      @pavansn6018 6 หลายเดือนก่อน

      I need a windowservice which take all the tiff files in specific directory and merge all the images into one tiff file and store in some specified location and it should generate XML where it should provide information regarding the images sz breadth and length

    • @gaikwadpremkumar5830
      @gaikwadpremkumar5830 6 หลายเดือนก่อน

      Hey from where should I study windows communication foundation? I'm really confused please guide me brother /sisters 🙏🙏

  • @dindjarin332
    @dindjarin332 หลายเดือนก่อน

    Hello sir, thanks for the video. i am developing a kiosk application for windows. The application must be always in the foreground & fullscreen. I want to check the application is in fullscreen & in the foreground using a windows service. I also want to check the current virtual desktop. If the current virtual desktop is not the one that opened the kiosk apllication, the service will kill the original application and starts a new instance on that virtual desktop. Is this something that can be achieved via a windows service?

  • @manalimalpani4601
    @manalimalpani4601 6 หลายเดือนก่อน +1

    Hello,
    I want to use the Windows service to move files from a network shared drive to the local folder on the machine. When I run the code without the service it works properly. But when I execute the same code inside the service it cannot execute it. So can you please advice how to use the shared network location inside the Windows Service. Thanks! Your video is very helpful

    • @lemastertech
      @lemastertech  6 หลายเดือนก่อน

      Hi I am not sure how to do that but it seems like maybe the network or shared drive could be blocking a service because it doesn’t have proper permissions where as when you run it once directly it uses your credentials by default? Not sure though!

    • @manalimalpani4601
      @manalimalpani4601 6 หลายเดือนก่อน

      @@lemastertech that's correct it's the samba shared drive to which I want to connect to. But not sure how to do the connects using username and password

    • @gaikwadpremkumar5830
      @gaikwadpremkumar5830 6 หลายเดือนก่อน

      Hey from where should I study windows communication foundation? I'm really confused please guide me brother /sisters 🙏🙏

  • @allusyamala428
    @allusyamala428 ปีที่แล้ว +1

    Very nice video and explained very well. I want to know how we can call RabbitMq service from windows service.

    • @lemastertech
      @lemastertech  ปีที่แล้ว

      Hi - interesting question but I have not done that personally so I’m sorry I’m not I can help you there!

  • @mananhphap2825
    @mananhphap2825 23 วันที่ผ่านมา +1

    nice video. Thank you so much

    • @lemastertech
      @lemastertech  21 วันที่ผ่านมา

      Im glad you liked it thank you for watching!

  • @svmandryk
    @svmandryk 6 หลายเดือนก่อน +1

    Thank you, quite a useful video!

    • @lemastertech
      @lemastertech  6 หลายเดือนก่อน

      Awesome glad you liked it thanks for watching!!

  • @denismugane2765
    @denismugane2765 9 หลายเดือนก่อน +1

    Nice tutorial, my problem is that the service does not start on windows boot even if its set automatic

    • @lemastertech
      @lemastertech  9 หลายเดือนก่อน

      For this you should just be able to add it to the startup folder on your pc!

  • @marthajsayers8146
    @marthajsayers8146 ปีที่แล้ว +1

    Thank you for responding and I apologize for being so late. I would also like to see how to create a web service that uses https, produces a link that can be used by external programs to access it or pass some data. I see a lot about the web service being created to be used by app on same server as the web service but very little about calling the web service from an external outside server.

    • @lemastertech
      @lemastertech  ปีที่แล้ว

      Hi that’s a cool idea too! To be honest I haven’t done much along that line so I’ll have to do some studying and learning first too!

  • @duongchinhngu2407
    @duongchinhngu2407 ปีที่แล้ว +1

    Love the way you do. Thanks a lot!

    • @lemastertech
      @lemastertech  ปีที่แล้ว

      Thanks so much for watching and for the nice comment!!

  • @NAwALMiRzA79
    @NAwALMiRzA79 9 หลายเดือนก่อน +1

    please make a video to store an api's data to sql using a windows service

    • @lemastertech
      @lemastertech  8 หลายเดือนก่อน

      Hi that’s a cool project idea, I can add it to my future projects list of video ideas!

  • @jkc6144
    @jkc6144 10 หลายเดือนก่อน +1

    subscribed, good explanation ✔

    • @lemastertech
      @lemastertech  10 หลายเดือนก่อน

      Thanks for watching!!

  • @marthajsayers8146
    @marthajsayers8146 ปีที่แล้ว +1

    That would be great! Thank you.

    • @lemastertech
      @lemastertech  ปีที่แล้ว

      Thank you for watching and all the comments!

  • @DaniLearnsIT
    @DaniLearnsIT 23 วันที่ผ่านมา

    Is it possible to transform a console application into a service? I have this one console application that has Quartz for time scheduling, but I am not sure if there is a way to grab my application, keep it doing all the scheduled tasks it does and just turn it into a Windows service!

  • @lesptitsoiseaux
    @lesptitsoiseaux ปีที่แล้ว +1

    Can a windows service be used to upload and download data to Google BigQuery or Google Drive? We need to pull via ODBC invoices from a sage 50 system and push in payment receipts so we're thinking of a windows service for this? Do you do contract work?

    • @lemastertech
      @lemastertech  ปีที่แล้ว +1

      Hi, yes it’s possible although often there are better methods for file transfer or data transfer protocols than a windows listener service! But I’ve never heard of a sage 50 system - I do not do contract work right now I have a full time day job!

  • @hansithennakoon9705
    @hansithennakoon9705 3 หลายเดือนก่อน

    Thanks for the video... Can I ask whether I can use windows form in the service or not.... I want to develop a windows service to load data from a csv file into SQL server.... So, I just create a windows form application to brows and read csv file, and then import into SQL server, inside the windows service project.... Installation did work but, when I start my service it gives me an error saying, 'An exception occurred in the service when handling the control request.'.... Can you give me an advice on what I can do? Thank you and much appreciated.

    • @lemastertech
      @lemastertech  3 หลายเดือนก่อน

      Hi it doesn’t sound like it should be a windows service if you want manual intervention checking for a file! Usually a parser or data transfer utility would automatically listen for new data without operator intervention. Just make a regular script and windows form project!

  • @joel_ecs
    @joel_ecs ปีที่แล้ว +1

    Very helpful tutorial, thank you :)

    • @lemastertech
      @lemastertech  ปีที่แล้ว

      You’re very welcome, thanks for watching!

  • @tatapornkanplook424
    @tatapornkanplook424 9 หลายเดือนก่อน +1

    Thanks for this video.

    • @lemastertech
      @lemastertech  9 หลายเดือนก่อน

      You’re very welcome thanks for watching!!!

  • @KabeloMasegela
    @KabeloMasegela 2 หลายเดือนก่อน

    Hi,
    I want to read a SQL online table, can you please make a tutorial that will show on how we read from an SQL table
    🙏

  • @MandisaKhanyile93
    @MandisaKhanyile93 8 หลายเดือนก่อน

    Please can you make a video of how to code a service to restart. Display screens or to restart website servers when they not displaying correct information or not picking up from the right file

    • @lemastertech
      @lemastertech  8 หลายเดือนก่อน

      Hi, sorry I really am not certain what you mean, like a refresh button but instead of clicking a refresh button in your url it would automatically refresh?

    • @TheFabulousCube
      @TheFabulousCube 2 หลายเดือนก่อน

      I'm not familiar with the Windows installer he used, I'm using WiX Installer v5 and it's pretty easy to add a to define the settings on the "Recovery" tab of the service. You'll need the Heatwave extension (I'm using VS 2022), and make sure to add the WixToolset.Util.wixext Nuget package and use that instead of the stock WiX , it's buggy.

  • @Mahesh-op3nw
    @Mahesh-op3nw 6 หลายเดือนก่อน +1

    Dear, Didnt find Windows Service Applicaiton while creating new application. Please let me know how to add it if not available in the Visual Studio, I am using Visual Studio 2022.

    • @lemastertech
      @lemastertech  5 หลายเดือนก่อน

      Might need to modify the install to include more packages and formats as templates for projects

  • @riccarrasquilla379
    @riccarrasquilla379 9 หลายเดือนก่อน +1

    thanks for the video. good stuff

    • @lemastertech
      @lemastertech  9 หลายเดือนก่อน

      Thanks for watching and for the nice comment!!

  • @gopinathc8753
    @gopinathc8753 ปีที่แล้ว +1

    Can we create service to check the machine connected to specific wifi if not it has to provide a popup to user. Kind of notification to remind them to do checkin and checkout in specific app. When he does tat it should store to env variables, if the person don do that then service need to send notification again in regular intervals untill user does it

    • @lemastertech
      @lemastertech  ปีที่แล้ว

      Hello, yes you can certainly, that’s how a lot of VPN services work. There’s a lot of specifics I don’t think I could cover in a TH-cam comment response but I’d suggest looking up similar examples from stack overflow! Goodluck that sounds like a cool project!

  • @joanesgonzaga675
    @joanesgonzaga675 ปีที่แล้ว +1

    Hey friend, thanks for the tutorial! You could improve thevideo showing how to create a system tray icon for the service created.

    • @lemastertech
      @lemastertech  ปีที่แล้ว

      Thanks for the suggestion! If I do a follow up to this I will consider adding that function too!

  • @tenriquez39
    @tenriquez39 11 หลายเดือนก่อน +1

    excelent ... thnks... from México

    • @lemastertech
      @lemastertech  11 หลายเดือนก่อน

      You’re welcome thanks for watching!

  • @cristoferrao8937
    @cristoferrao8937 ปีที่แล้ว +1

    hi wanted to see create protocol to call from website then run a print code of devexpress reports

    • @lemastertech
      @lemastertech  ปีที่แล้ว

      Hi, that’s an interesting idea but I’m not sure how to do that off the top of my head, sorry!

  • @rovi-farmiigranhermanodela8693
    @rovi-farmiigranhermanodela8693 11 หลายเดือนก่อน +1

    Can you do a video for a WatchDog that always it detect an application is not running, start that app

    • @lemastertech
      @lemastertech  11 หลายเดือนก่อน +1

      Hi that should not be too difficult! I may make a tutorial on it soon but there are also a lot of great stack overflow articles on how to do that!

    • @rovi-farmiigranhermanodela8693
      @rovi-farmiigranhermanodela8693 11 หลายเดือนก่อน

      @@lemastertechI thought that but is some problem with “Sesion 0 isolation” that makes me think that may be is not any way to do it .

  • @RaphaelRejes
    @RaphaelRejes ปีที่แล้ว +1

    Great job, thanks!!!

    • @lemastertech
      @lemastertech  ปีที่แล้ว

      Thank you, and thanks for watching!!

  • @virajsingh9865
    @virajsingh9865 ปีที่แล้ว +1

    Hello Brother , Thank you so much for this useful video.

    • @lemastertech
      @lemastertech  ปีที่แล้ว +1

      You’re very welcome thank you for watching!!

  • @WendyGesler-w8s
    @WendyGesler-w8s 8 หลายเดือนก่อน

    This video was wonderful. But I'm using .Net 6 and this example seems incompatible. I also want to use data injection to fill out the full extent of my background tasks. Any idea if this is possible?

    • @lemastertech
      @lemastertech  8 หลายเดือนก่อน

      Hi I’m sorry I don’t think there’s any explicit invalid syntactical things between this example and .net6 what errors is is giving you?? And I think your target application is definitely feasible but for data injection you’d be parsing a Csv file or extracting from a sql table or some other data injection?

  • @ganeshkharat3533
    @ganeshkharat3533 หลายเดือนก่อน +1

    Thank You...

    • @lemastertech
      @lemastertech  หลายเดือนก่อน

      Youre welcome thanks for watching!

  • @carlosbraga1902
    @carlosbraga1902 ปีที่แล้ว +1

    Very good. Thank you !

    • @lemastertech
      @lemastertech  ปีที่แล้ว

      You’re welcome thank you for watching!!

  • @mthuthuzeligagela6574
    @mthuthuzeligagela6574 ปีที่แล้ว +1

    Very helpful thanks

    • @lemastertech
      @lemastertech  ปีที่แล้ว

      You're welcome, thanks for watching!

  • @azgarmohd9571
    @azgarmohd9571 ปีที่แล้ว +1

    Wonderful. Thanks a lot

    • @lemastertech
      @lemastertech  ปีที่แล้ว

      You’re very welcome thank you for watching!

  • @mustijack
    @mustijack 5 หลายเดือนก่อน +1

    Cool Thanks.

    • @lemastertech
      @lemastertech  5 หลายเดือนก่อน +1

      You’re welcome thank you for watching!

  • @tejeshkollapaneni4456
    @tejeshkollapaneni4456 ปีที่แล้ว +1

    Hello Brother! Happy to Have you .
    Your Lit. where are you from(State)
    Thanks is a little thing word for your Presentation.

    • @lemastertech
      @lemastertech  ปีที่แล้ว +2

      Thanks for the nice comment and I am originally from Ohio!

    • @tejeshkollapaneni4456
      @tejeshkollapaneni4456 ปีที่แล้ว

      @@lemastertech Catch you Soon!

  • @swayamprakash6
    @swayamprakash6 6 หลายเดือนก่อน +1

    Hi @lemastertech, I am trying to start a wpf app from window service but not opening. can you help me?

    • @lemastertech
      @lemastertech  6 หลายเดือนก่อน

      Hi what is WPF?

  • @ElCidPhysics90
    @ElCidPhysics90 ปีที่แล้ว +1

    I’m about to write a service that needs to run it’s processes at a certain time. Is there an easy way to do that?

    • @lemastertech
      @lemastertech  ปีที่แล้ว +1

      Hi - in this example I use a time difference to trigger the event, you could replace that with a specific clock time, so rather than every ten seconds you could either make that every 24 hours, and just make sure to start it when you want it to start, or you could check against the computer clock for a trigger! Goodluck!

  • @eyobmekonnen9150
    @eyobmekonnen9150 9 หลายเดือนก่อน +1

    i want to create 2 application the first one, on server side windows service app can host sql database connection, and the second app from domain side when app load search for server windows service on the network and connect with the database using services. can you help please.

    • @lemastertech
      @lemastertech  9 หลายเดือนก่อน

      Hi - this is a common application for a listener partner service. There are some pretty good examples online of how to set up a folder or destination listener and parse it into a sql table entry! Check out some stack overflow examples!!

  • @HelpyHelpy
    @HelpyHelpy ปีที่แล้ว +1

    Thanks a lot!!!!!!

    • @lemastertech
      @lemastertech  ปีที่แล้ว

      You’re very welcome thanks for watching!!

  • @GoranSpirkoski
    @GoranSpirkoski ปีที่แล้ว

    I want to see windows service thats act as an auto updater, example soon as possible when trigger that some attached process is started in its directory to extract the data.

    • @lemastertech
      @lemastertech  ปีที่แล้ว +1

      That’s an interesting idea! Like a stock price updater or email utility?

    • @GoranSpirkoski
      @GoranSpirkoski ปีที่แล้ว

      @@lemastertech Something like, game updater, Service gonna be installed in appdata, when windows startup, gonna check for version of zipped data, and gonna monitoring for specific process when detect. Example when process hl.exe is started then gonna extract the zipped data in directory where hl.exe is located

  • @florentvanneste1610
    @florentvanneste1610 9 หลายเดือนก่อน +1

    Hello,
    Thank you for the great Job.
    Let me do a remark :
    you should create an specific object for the log to show only what is the code of the service and what is the code of the logger.
    And no need to use File.Create when the file doesn't exist because File.AppendText works even if the File was just created.
    And prefer using the methods Start and Stop()
    So here is my code of the logger :
    public enum LogType
    {
    Debug,
    Info,
    Warning,
    Error
    }
    public static class Logger
    {
    public static void WriteLog(string logpath, LogType ltype, string text)
    {
    if(!string.IsNullOrWhiteSpace(logpath))
    {
    if (!File.Exists(logpath)) { File.Create(logpath); }
    using (StreamWriter sw = File.AppendText(logpath))
    {
    sw.WriteLine(FormatLog(ltype, text));
    }
    }
    }
    private static string FormatLog(LogType ltype, string text)
    {
    string s = string.Format("{0} - {1} : {2}", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss.fff"), ltype.ToString(), text);
    return s;
    }
    }
    You can use it as you want
    So with the logger the code of the service become :
    public partial class TestService : ServiceBase
    {
    private string _logpath;
    private Timer _watchdog;
    public TestService()
    {
    _logpath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs");
    _watchdog = new Timer();
    _watchdog.Elapsed += _watchdog_Elapsed;
    _watchdog.Interval = 1000;
    InitializeComponent();
    }
    private void _watchdog_Elapsed(object sender, ElapsedEventArgs e)
    {
    Logger.WriteLog(_logpath, LogType.Info, "Service running");
    }
    protected override void OnStart(string[] args)
    {
    _watchdog.Start();
    Logger.WriteLog(_logpath, LogType.Info, "Service Start");
    }
    protected override void OnStop()
    {
    Logger.WriteLog(_logpath, LogType.Info, "Service Stop");
    _watchdog.Sopt();
    }
    Enjoy.

    • @florentvanneste1610
      @florentvanneste1610 9 หลายเดือนก่อน

      Sorry I made a little mistake in the logger class in the WriteLog Method : the File.AppendAllText takes in charge the opening ang closing file before and after writing text into it.
      So, here is the final version
      public static class Logger
      {
      public static void WriteLog(string logpath, LogType ltype, string text)
      {
      if(!string.IsNullOrWhiteSpace(logpath))
      {
      File.AppendAllText(logpath, FormatLog(ltype, text));
      }
      }
      private static string FormatLog(LogType ltype, string text)
      {
      StringBuilder sb = new StringBuilder();
      sb.AppendLine(string.Format("{0} - {1} : {2}", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss.fff"), ltype.ToString(), text));
      return sb.ToString();
      }
      }
      Hope you'll enjoy.

    • @lemastertech
      @lemastertech  9 หลายเดือนก่อน

      hi! thanks for watching and for that useful comment, hopefully future viewers find it useful too!

  • @kushagrarai7799
    @kushagrarai7799 6 หลายเดือนก่อน +1

    what is directory at 10:14 ...how to find??

    • @lemastertech
      @lemastertech  6 หลายเดือนก่อน

      Hi, directories that your code lives in can be found just be right clicking your code and find in explorer option!

  • @yasmeenadel154
    @yasmeenadel154 ปีที่แล้ว +1

    thanks

    • @lemastertech
      @lemastertech  ปีที่แล้ว

      Very welcome, thanks for watching!

  • @p_kumbhalkar25
    @p_kumbhalkar25 ปีที่แล้ว +1

    How can we migrate the windows service of .net 4 project to console application in .net 6??

    • @lemastertech
      @lemastertech  ปีที่แล้ว +1

      Hi I haven’t personally done this but I read about it here steven-giesel.com/blogPost/f531dded-44af-4341-871c-d54875877900
      Try this!

  • @alirezaa5618
    @alirezaa5618 10 หลายเดือนก่อน +1

    Thanck

    • @lemastertech
      @lemastertech  10 หลายเดือนก่อน

      Thanks for watching!!

  • @jkc6144
    @jkc6144 10 หลายเดือนก่อน +1

    Is there a way to auto install and auto run the service ?

    • @lemastertech
      @lemastertech  10 หลายเดือนก่อน

      Hi do you mean like the code automatically installs it as a service and then gets it running just by executing the program? It is possible but almost every computer would likely flag a program like that as malware unless given proper security permissions!

    • @lemastertech
      @lemastertech  10 หลายเดือนก่อน

      Thanks for watching! I responded to your other comment on this question

    • @jkc6144
      @jkc6144 10 หลายเดือนก่อน

      @@lemastertech Yes running just by executing a program, because it's still more convenient to give permission than going to services. Is that possible ?

  • @bohailang
    @bohailang 5 หลายเดือนก่อน +1

    I have a .bat file that calls a python file to transfer data from one folder to another. How do I add this into my windows service?

  • @MandisaKhanyile93
    @MandisaKhanyile93 8 หลายเดือนก่อน +1

    Hello, nice🎉

    • @lemastertech
      @lemastertech  8 หลายเดือนก่อน

      Thank you very much!!

  • @SumitGupta-wb2vu
    @SumitGupta-wb2vu 5 หลายเดือนก่อน +1

    Hi window service is created but not able to start the service this throwing error that can not start on Local computer with error code1053 showing the service did not respond on start and stop. i am stuck here for last 2 days please give me solution

    • @lemastertech
      @lemastertech  5 หลายเดือนก่อน

      Not sure I have never encountered this error I am sorry!

  • @sowik4770
    @sowik4770 10 หลายเดือนก่อน

    how you get this thing what we can see at the top of the screen in 13:09? its something to split aplication windows in screen?

    • @lemastertech
      @lemastertech  10 หลายเดือนก่อน

      Hi I think you’re just referring to VScode which has a feature to let you dock windows at any part of the screen?

  • @maxi-g
    @maxi-g ปีที่แล้ว +1

    What‘s the difference between this and a dotnet worker service ?

    • @lemastertech
      @lemastertech  ปีที่แล้ว +1

      Hi - once something is running as a windows service there really isn’t a difference! The differences are mainly just in what way you develop the service - I believe a dotnet worker service just uses a slightly different template for setting it up!

    • @maxi-g
      @maxi-g ปีที่แล้ว +1

      @@lemastertech thank‘s 👍🏻

    • @lemastertech
      @lemastertech  ปีที่แล้ว +1

      @@maxi-g You got it, thanks for watching!

  • @RevangeXX
    @RevangeXX 8 หลายเดือนก่อน +1

    Hi, unfortunately I always get the following error when I try to start the service: Could not start Windows Service, Error 1064. Can you help me?

    • @lemastertech
      @lemastertech  8 หลายเดือนก่อน

      Hello I am sorry I have not experienced that before - have you tried to find details regarding that error code online yet?

  • @harithdanish5635
    @harithdanish5635 7 หลายเดือนก่อน +1

    Hai can i know how to make windows service can run a program code?

    • @lemastertech
      @lemastertech  7 หลายเดือนก่อน

      Hello. The example in this video can run any code you build into it so I think your question is a little confusing!

    • @harithdanish5635
      @harithdanish5635 7 หลายเดือนก่อน

      sorry my bad i mean when we start the service it can open exe file?
      @@lemastertech

  • @DurgeshMarrathe
    @DurgeshMarrathe 4 หลายเดือนก่อน +1

    Hello.
    i want to create windows service for the api data
    take data from 2 different application API
    and save it to the Temp database
    and this service is call after each 1h
    its related to product order
    Requirement:
    Creating a Windows service, in C# which is connected to a TMP database, where Orders (from external apps), Products (from GAMMA) are shared. The app is able to periodically communicate with App4Sales and Prestashop APIs to:
    Export Product descriptions and product availability
    Collect Orders generated by above platform

    • @lemastertech
      @lemastertech  4 หลายเดือนก่อน

      That sounds awesome!! I think it’s a little too complicated for me to be able to help with much over TH-cam comments!

  • @legolastht
    @legolastht 10 หลายเดือนก่อน +1

    Thanks

    • @lemastertech
      @lemastertech  10 หลายเดือนก่อน

      You’re very welcome thank you for watching!!

  • @flioink
    @flioink ปีที่แล้ว +1

    C#?
    Why not, I watch more out of curiosity.
    Definitely useful if you use Unity, but I'm more of an Unreal user.

    • @lemastertech
      @lemastertech  ปีที่แล้ว +1

      Yeah I want to try to keep a variety in the channel so I don’t get stuck in a rut, and I had to develop some services for work in C# last week so figured it’d make a good tutorial! 😁

  • @allusyamala428
    @allusyamala428 ปีที่แล้ว

    Can u please tell me how we can call Rabbit MQ services from windows services...?

    • @lemastertech
      @lemastertech  ปีที่แล้ว

      Hi - interesting question but I have not done that personally so I’m sorry I’m not I can help you there!

  • @UsamaNasirMRL
    @UsamaNasirMRL 6 หลายเดือนก่อน +1

    i installed a window service in a PC it stop automatically , how can i overcome this
    its Startup type is Automatic but when i restart my PC it donot start automatically

    • @lemastertech
      @lemastertech  6 หลายเดือนก่อน

      You might have a dedicated “start”
      Folder where you can add executables and services to startup when the computer starts up you could add it there as well!

  • @aminkhosravi5073
    @aminkhosravi5073 ปีที่แล้ว +2

    Thank you for the GOLD! Is it possible to publish the project into a folder and create a windows service with a reference to the executable file in that folder? I want to use and run the service on a different computer.

    • @lemastertech
      @lemastertech  ปีที่แล้ว +1

      Hi! You are welcome, and yes it should be possible but mostly you’d follow these same steps on whatever computer you are publishing it on - if you mean like putting the service on a shared network folder or drive and creating the service from there I assume that is doable but I have not done that personally myself!

    • @aminkhosravi5073
      @aminkhosravi5073 ปีที่แล้ว

      @@lemastertech Thanks for the response! Does windows stop the service once it goes to sleep or hibernate mode? It was working like a charm! before I close the lid of my laptop. I checked the log file to see if it works fine when I woke up this morning. I didn't see any "stopped service" log into the txt file, but a new successful log in message neither. I used your tutorial to create a windows service that loges into my stack account every once in a while through Selenium. It adds a new line to the log file when successfully logged in. Would you help me with this? It's not stopped obviously.

    • @aminkhosravi5073
      @aminkhosravi5073 ปีที่แล้ว

      An update to my previous comment; It added a new "successfully logged in" log message to the log file after working with my laptop for less than an hour! As I told you it wasn't stopped. Is there any way to keep the service running even in sleep or hibernate mode? Do I need to add a piece of code to the existing script?

    • @siavashmehmandoost2198
      @siavashmehmandoost2198 ปีที่แล้ว

      I had the same problem! I need it to keep running even if I close lid of laptop. I tried to make it happen by overriding OnPowerEvent() but it was not triggered!@@lemastertech

  • @Rakesh-d8p8f
    @Rakesh-d8p8f หลายเดือนก่อน

    How to create a service that read the printing data?

  • @maliknoman4116
    @maliknoman4116 ปีที่แล้ว +1

    Make a service which open and browser in our local system

    • @lemastertech
      @lemastertech  ปีที่แล้ว

      Good idea I’ll consider making a follow up to this soon!

  • @michaelreddish9124
    @michaelreddish9124 ปีที่แล้ว

    Not seeing the Windows Service with .Net Framework when I search.... any ideas?

    • @lemastertech
      @lemastertech  ปีที่แล้ว

      Hi, so there are a ton of packages you can choose to include or not include when you install Visual Studio so you may need to check your included packages and if you don’t have .net framework add that! It probably will require some extra storage!

  • @pratyushpanigrahi7691
    @pratyushpanigrahi7691 ปีที่แล้ว

    Hi,where can i get the code?

    • @lemastertech
      @lemastertech  ปีที่แล้ว

      Hi if you make a .net framework c# project in visual studio there’s only like four lines of code you need to edit from that

  • @keyonvassell6117
    @keyonvassell6117 6 หลายเดือนก่อน +1

    Has anyone encountered the Error 1064 when trying to start the service?

    • @lemastertech
      @lemastertech  6 หลายเดือนก่อน

      I found a decent page with a lot of folks having that issue you might want to check out!! stackoverflow.com/questions/53365517/could-not-start-windows-service-error-1064

  • @AnnonymusWithTruth
    @AnnonymusWithTruth 9 หลายเดือนก่อน

    i dont find windows services template in visual studui 2022, i did installed the additional project templates ...help

    • @lemastertech
      @lemastertech  9 หลายเดือนก่อน

      Hello - I’m sorry I don’t understand exactly what your issue is?? You’re saying the project template file I start the tutorial by using isn’t available for you?

    • @AnnonymusWithTruth
      @AnnonymusWithTruth 9 หลายเดือนก่อน +1

      @@lemastertech thanks for replying, the issue is solved...that was because I did not installed wcf

    • @AnnonymusWithTruth
      @AnnonymusWithTruth 9 หลายเดือนก่อน

      @@lemastertech theres is another problem , when i am installing my service with installutill,exe it gives me this error:
      Running a transacted installation.
      Beginning the Install phase of the installation.
      See the contents of the log file for the C:\Users\BIRJU\source
      epos\FSW_Serive\FSW_Serive\bin\Debug\FSW_Serive.exe assembly's progress.
      The file is located at C:\Users\BIRJU\source
      epos\FSW_Serive\FSW_Serive\bin\Debug\FSW_Serive.InstallLog.
      Installing assembly 'C:\Users\BIRJU\source
      epos\FSW_Serive\FSW_Serive\bin\Debug\FSW_Serive.exe'.
      Affected parameters are:
      logtoconsole =
      logfile = C:\Users\BIRJU\source
      epos\FSW_Serive\FSW_Serive\bin\Debug\FSW_Serive.InstallLog
      assemblypath = C:\Users\BIRJU\source
      epos\FSW_Serive\FSW_Serive\bin\Debug\FSW_Serive.exe
      An exception occurred during the Install phase.
      System.ComponentModel.Win32Exception: No mapping between account names and security IDs was done
      The Rollback phase of the installation is beginning.
      See the contents of the log file for the C:\Users\BIRJU\source
      epos\FSW_Serive\FSW_Serive\bin\Debug\FSW_Serive.exe assembly's progress.
      The file is located at C:\Users\BIRJU\source
      epos\FSW_Serive\FSW_Serive\bin\Debug\FSW_Serive.InstallLog.
      Rolling back assembly 'C:\Users\BIRJU\source
      epos\FSW_Serive\FSW_Serive\bin\Debug\FSW_Serive.exe'.
      Affected parameters are:
      logtoconsole =
      logfile = C:\Users\BIRJU\source
      epos\FSW_Serive\FSW_Serive\bin\Debug\FSW_Serive.InstallLog
      assemblypath = C:\Users\BIRJU\source
      epos\FSW_Serive\FSW_Serive\bin\Debug\FSW_Serive.exe
      The Rollback phase completed successfully.
      The transacted install has completed.
      The installation failed, and the rollback has been performed.

    • @gaikwadpremkumar5830
      @gaikwadpremkumar5830 6 หลายเดือนก่อน

      Hey from where should I study windows communication foundation? I'm really confused please guide me brother /sisters 🙏🙏