Recently developed a Windows Service Project

Source: Internet
Author: User

A recent project involves Windows Service and WebService. I want to write down a little bit of experience in this project, which may be helpful to my friends who encounter the same problem, haha.

At the beginning of the project, I didn't plan to use the layer-3 architecture that I used to use, because the project is too small, A solution contains only one web site and one Windows service. The web site contains simple WebService and several pages. The only special point is that WebService is written in VB, while other pages use C #. For ease of writing, I copied the sqlhelper class that was frequently used in the past to the app_code folder under the Web site, because WebService (the class name is ibmload. CS) when using the VB language, an error is reported during compilation, indicating ibmload. CS and sqlhelper. CS cannot be stored in the app_code folder at the same time, because either of them uses VB or C #. For this reason, I added another class library project and put sqlhelper. CS in this class library project. Later I thought about how to separate layers in the previous mode. In this case, I will reference other projects in the Windows service project, such as idal, sqlserverdal, and entity, which is not the same as when I used Windows service, all of the projects I wrote earlierCodeThey are all put together, and chaos is a little messy, but they don't feel any bad about themselves. In this case, the code is written in other places, and there are few lines of code in Windows service, but I am not used to it.

However, an error occurred when I started the service after installation, for example:

It was discovered later that Windows Service referenced several other projects and generated a bunch of DLL files, while I used the previous method during installation, only one EXE file is copied to the target server for installation. In fact, the actual business logic of this service is installed in the pile of DLL files without DLL files, at this time, Windows service is like a blank piece of white paper, so there is nothing to do.

so I unmount the installed Service, copy the EXE and DLL files to the target server at the same time, and then run the installation. After the installation is complete, start the service to run properly. But now I have a question: is it necessary to implement it in a hierarchical manner if it is just a separate Windows Service Project? Hope you can give me some advice.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.