473,396 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Windows Service (.NET) and MFC

I want to write a windows service (myService) by using C++/CLI (Visual Studio 2005). This myService can use MFC function for OLE Automation.

Just for a first try, I did the following project configuration and coding:

• Creating a Windows Service under C++/CRL
• Adding ServiceInstaller with start type automatic and sereviceprocessInstaller with Account Local System
• Setting MFC in a Shared DLL
• Setting Common Language Runtime Support (/clr)
• Setting Multithreaded-Debug-DLL (/MDd)
• Adding #include <afxdisp.h> in stdafx.h

Compile is always successful. But when I use myServie.exe –Install to install my windows service in Visual Studio 2005 Command Prompt, I always get the following exceptions

When debugging:
Unhandled exception at 0x78374588 (mfc80ud.dll) in myService.exe: 0xC0000005: Access Violation reading location 0x00000000.

In Visual Studio 2005 Command Prompt:
Unhandled exception: System.AccessViolationException
Attempted to read or write protected memory.
This is often an indication that other memory is corrupt.
at _wWinMainCRTStartup()

Does anyone know the reason? Where am I wrong?

Many thanks for any help!
Jul 17 '08 #1
0 909

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Michael Riggio | last post by:
Is there a way to have a windows service instantiate a class that is a web service, which will then be accessible to clients via HTTP? Thanks, -Mike
2
by: Neslihan ERDEM | last post by:
Every body Hi first of all I say Why do I need Windows Service / Every Day I create XML file . I writed a XML web service And .I join this servis Windows service. I create Windows Service that...
2
by: Mark | last post by:
I created an extremely simple windows service that only writes to the EventLogs on Stop and Pause. I installed it using the InstallUtil.exe program, the output of which is below. It appears to be...
9
by: SP | last post by:
Hi All, I wrote a windows service which is supposed to stop after specified amount of time. I am calling OnStop() after specified time. OnStop() methods executed but I dont see the service...
0
by: Yueming | last post by:
Hello, I am using Visual Studio .NET 2003 (7.1) C++ on Windows XP. I created a project using Windows Service (.NET). I used all the default except my project name. After the project is...
1
by: Todd Jaspers | last post by:
Hey guys, I've written an NT Service. I seem to have everything it needs, an OnStart, OnStop, events. It compiles fine and I don't get any errors or warnings. My problem is that I don't have an...
2
by: zh.zhen | last post by:
i use try..catch in my windows service,and when some exception occurs, i write it to event logs. in webapplication ,if you use a catch to "hold" an exception, and do not throw up, the exception...
2
by: teejayem | last post by:
I am having problems creating a Windows Service using Visual Studio 2005. Code as follows:- Imports System.IO Imports System.Net.Mail
2
by: =?Utf-8?B?Q2hyaXN0aWFuIEhhdmVs?= | last post by:
Hi, I have successfully developed a service (not a Webservice) using .NET 1.1 and C#. I added the requiered ProcessInstaller, debugged the service and it works. Now I want to create a setup...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.