开发者

Reuse Windows Service classes

I have a ASP Net project of the type Windows Service.

When I build that project an exe file is generated.

Now I also have another project os the type Web Service, that uses开发者_如何转开发 classes from the previous Windows Service project.

When I build the Web Service, on it's bin/debug folder, the Windows Service exe is there, instead of a DLL.

This way, when I deploy the Web Service on ISS, I get an exception when the part of the code that instatiates a class on the Windows Service project is executed.

The only whay I found to solve this issue, is to make the output type of the Windows Service to DLL instead of EXE, and the Web Service runs correctly.

But, of course, when I try to install the Windows Service, I get this error:

Reuse Windows Service classes

Can I even do this?


Windows Services and web services are different project types. You cannot run the same executable. You have to options:

  1. Either you put the common code into a class library and create a project for the windows service and one for the webservice
  2. You create to build targets.

Option 1 seems to be easier for me

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜