473,406 Members | 2,633 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,406 software developers and data experts.

Calling C++ library from ASP.NET web service

I have a web service, written in C#, that calls a managed C++ library that
itself calls a third-party unmanaged C++ library (which is its only purpose -
to allow me to call some unmanaged C++ from C#). When trying to compile/run
the web service, I get the error:

This application has failed to start because the application configuration
is incorrect. Reinstalling the application may fix this problem. (Exception
from HRESULT: 0x800736B1)

I copied the files: msvcm80d.dll, msvcp80d.dll, msvcr80d.dll into the web
service's bin directory and now I get the error:

The specified module could not be found. (Exception from HRESULT: 0x8007007E)

Firstly, is it right that I need to copy these mscv* assemblies into the bin
directory in order for it to work (I have already installed the Visual C++
2005 Runtime Libraries on the machine)?

Secondly, how can I get passed the "The specified module could not be found"
error?

I suspect that, since a win forms and click once application can both call
the same library without any problems, and as the web service runs under the
limited ASPNET account, that there is a permission problem that means some
necessary library on the machine cannot be found during load time. However I
am at a loss as to what the library it cannot find is and how I can resolve
this. Any help would be greatly appreciated (P.S. my C++ knowledge/experience
is VERY limited).
Apr 27 '07 #1
9 3688

"Zoodor" <Zo****@discussions.microsoft.comwrote in message
news:E8**********************************@microsof t.com...
>I have a web service, written in C#, that calls a managed C++ library that
itself calls a third-party unmanaged C++ library (which is its only
purpose -
to allow me to call some unmanaged C++ from C#). When trying to
compile/run
the web service, I get the error:

This application has failed to start because the application configuration
is incorrect. Reinstalling the application may fix this problem.
(Exception
from HRESULT: 0x800736B1)
<http://xoreax.helpserve.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticl eid=37&nav=0>

Long

<http://www.google.com/search?hl=en&q=This+application+has+failed+to+star t+because+the+application+configuration+&btnG=Goog le+Search>

Short

http://tinyurl.com/ytq4rl

Apr 27 '07 #2
Thankyou for your response.

Unfortunately, I still have not managed to resolve my problem. I think I
better understand why I needed to copy the msvc* libraries, but I am still
encountering the "The specified module could not be found" error.

Please note that a .NET application on the machine runs fine, but a web
service doing pretty much the same thing (i.e. its calling the same methods
in the same assemblies) fails. The only difference I can think of is that the
web service is running under a more restricted account.

I have run dependency walker on the "bridge" assembly (the one sitting
between my main C# code and the C++ library) and the only warning I get is
that "MSJAVA.dll" could not be found. It would seem unlikely to me that this
is a problem. Running dependency walker on the third-party C++ assembly
brings back no warnings or errors.

Any further suggestions?

Thanks

Mark
Apr 27 '07 #3

"Zoodor" <Zo****@discussions.microsoft.comwrote in message
news:61**********************************@microsof t.com...
Thankyou for your response.

Unfortunately, I still have not managed to resolve my problem. I think I
better understand why I needed to copy the msvc* libraries, but I am still
encountering the "The specified module could not be found" error.

Please note that a .NET application on the machine runs fine, but a web
service doing pretty much the same thing (i.e. its calling the same
methods
in the same assemblies) fails. The only difference I can think of is that
the
web service is running under a more restricted account.
I doubt that's the problem. It may be, that the C++ program is a COM
application and it's not registered in the registry. If it was some kind of
account restriction, some kind of *Access Denied* message would be coming
back.

The message is what it is "The specified module could not be found" don't
make more of it than what it is, which you'll have to find out why whatever
module it is cannot be found.

I think you have some kind of pathing or registration Dll issue.

Apr 27 '07 #4
I doubt that's the problem. It may be, that the C++ program is a COM
application and it's not registered in the registry. If it was some kind of
account restriction, some kind of *Access Denied* message would be coming
back.
The C++ library is not a COM application.
I think you have some kind of pathing or registration Dll issue.
I tried compiling the web service into an assembly and wrote an application
that used the web service class directly (as if it was just a class in an
assembly). I ran it from the web service's bin directory, and it worked fine.
When the exact same method is called via a web service call I am still
getting the same "The specified module could not be found" error.

This is getting really frustrating. If anyone has any suggestions on this, I
would really appreciate it. Just finding out what the missing module is would
be a good start.
May 1 '07 #5

"Zoodor" <Zo****@discussions.microsoft.comwrote in message
news:D1**********************************@microsof t.com...
>I doubt that's the problem. It may be, that the C++ program is a COM
application and it's not registered in the registry. If it was some kind
of
account restriction, some kind of *Access Denied* message would be coming
back.

The C++ library is not a COM application.
>I think you have some kind of pathing or registration Dll issue.

I tried compiling the web service into an assembly and wrote an
application
that used the web service class directly (as if it was just a class in an
assembly). I ran it from the web service's bin directory, and it worked
fine.
When the exact same method is called via a web service call I am still
getting the same "The specified module could not be found" error.

This is getting really frustrating. If anyone has any suggestions on this,
I
would really appreciate it. Just finding out what the missing module is
would
be a good start.
..NET will sometimes return extra information in the InnerText property of
the exception.

Have you tried using that feature, dumping messages to a text file to see
all of the error exception message?

May 1 '07 #6
Unfortunately, I do not get an exception in Visual Studio that I can inspect.
The exception information is displayed as a web page when I try and access
the web service from my web browser. I tried attaching Visual Studio to the
w3wp process, but it didn't make any difference. Web page below in case it
contains some clue I am missing:

Server Error in '/MtfServices' Application.
--------------------------------------------------------------------------------

The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: The specified module
could not be found. (Exception from HRESULT: 0x8007007E)

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:
[FileNotFoundException: The specified module could not be found. (Exception
from HRESULT: 0x8007007E)]
System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase,
Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark,
Boolean throwOnFileNotFound, Boolean forIntrospection) +0
System.Reflection.Assembly.InternalLoad(AssemblyNa me assemblyRef,
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean
forIntrospection) +211
System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence
assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +141
System.Reflection.Assembly.Load(String assemblyString) +25
System.Web.Configuration.CompilationSection.LoadAs semblyHelper(String
assemblyName, Boolean starDirective) +32

[ConfigurationErrorsException: The specified module could not be found.
(Exception from HRESULT: 0x8007007E)]
System.Web.Configuration.CompilationSection.LoadAs semblyHelper(String
assemblyName, Boolean starDirective) +596

System.Web.Configuration.CompilationSection.LoadAl lAssembliesFromAppDomainBinDirectory() +3479049
System.Web.Configuration.CompilationSection.LoadAs sembly(AssemblyInfo ai)
+46

System.Web.Compilation.BuildManager.GetReferencedA ssemblies(CompilationSection compConfig) +177
System.Web.Compilation.BuildProvidersCompiler..cto r(VirtualPath
configPath, Boolean supportLocalization, String outputAssemblyName) +180

System.Web.Compilation.CodeDirectoryCompiler.GetCo deDirectoryAssembly(VirtualPath
virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet
excludedSubdirectories, Boolean isDirectoryAllowed) +347
System.Web.Compilation.BuildManager.CompileCodeDir ectory(VirtualPath
virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet
excludedSubdirectories) +125
System.Web.Compilation.BuildManager.CompileCodeDir ectories() +525
System.Web.Compilation.BuildManager.EnsureTopLevel FilesCompiled() +448

[HttpException (0x80004005): The specified module could not be found.
(Exception from HRESULT: 0x8007007E)]
System.Web.Compilation.BuildManager.ReportTopLevel CompilationException()
+57
System.Web.Compilation.BuildManager.EnsureTopLevel FilesCompiled() +612
System.Web.Hosting.HostingEnvironment.Initialize(A pplicationManager
appManager, IApplicationHost appHost, IConfigMapPathFactory
configMapPathFactory, HostingEnvironmentParameters hostingParameters) +456

[HttpException (0x80004005): The specified module could not be found.
(Exception from HRESULT: 0x8007007E)]
System.Web.HttpRuntime.FirstRequestInit(HttpContex t context) +3426855
System.Web.HttpRuntime.EnsureFirstRequestInit(Http Context context) +88
System.Web.HttpRuntime.ProcessRequestInternal(Http WorkerRequest wr) +149


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET
Version:2.0.50727.42
May 2 '07 #7
<snipped>

I suggest you put some Exception handling in the code to catch the exception
and put a brake point on it or some other means of addressing the Exception
and look at the Exception's Inner Text messages, which might give you more
information and pin point the name of missing module that you're obviously
not getting in a trace.
May 2 '07 #8
I suggest you put some Exception handling in the code to catch the exception
and put a brake point on it or some other means of addressing the Exception
and look at the Exception's Inner Text messages, which might give you more
information and pin point the name of missing module that you're obviously
not getting in a trace.
It's not even getting as far as running my code so I can't put any exception
handling or break points in to help :-(
May 2 '07 #9

"Zoodor" <Zo****@discussions.microsoft.comwrote in message
news:C9**********************************@microsof t.com...
>I suggest you put some Exception handling in the code to catch the
exception
and put a brake point on it or some other means of addressing the
Exception
and look at the Exception's Inner Text messages, which might give you
more
information and pin point the name of missing module that you're
obviously
not getting in a trace.

It's not even getting as far as running my code so I can't put any
exception
handling or break points in to help :-(
Have you tried attaching the debugger to the ASP.NET worker process and
trying to debug your application that way. It may help you get to the
Exception in code so you can see the Innertext messages for the Exception.

http://support.microsoft.com/kb/893657
http://preview.tinyurl.com/23ard5

You also might want to use Exception under the Debug menu in the IDE. You
can set the Win32 Exception and throw the *Module not found* exception to
trap it in code.
May 4 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Patrick | last post by:
I am almost certain that I could use HTTP Post/Get to submit XML Web Service call (over SSL as well, if using Version 3 of MSXML2) from an ASP Application? However, would I only be able to call...
5
by: NickC | last post by:
OK so not a JavaScript question but don't know where else to ask and judging from some of the knowledge I have seen here in the past I reckon someone here might just have some idea. When the Web...
4
by: Jasleen | last post by:
I have written one Widows Service in ATL, having a ATL component running. Now it is very easy to create the VC client by calling CoCreateINstanceEx to create the component running in the service...
1
by: Sudha | last post by:
Hi All, I've a requirement to call a web service from an ASP page. As we have only two options, using SOAP Toolkit 3.0 and XMLHttp object, which are not upto my requirement, I thought I will...
0
by: han zhiyang | last post by:
I've just studied the "how to" web service and the async pattern in donnet.I make a test with these knowledges,but I got a strange result. Here is my test. 1.Write a simple "Add" service named...
3
by: Pratcp | last post by:
Hello, I have an asp.net Web app in vb.net trying to call a C# web service which takes a reference parameter. I tried a simple C# web app to call the Web service and it works perfectly. However,...
4
by: Henning M | last post by:
Hej All Im relativ new to VB.net and im trying to collect som device information using cfgmgr32.dll I use - Declare Function GetListLength Lib "cfgmgr32.dll" Alias...
2
by: Haroon_Saeed | last post by:
Hey, I wrote a managed c++ class library in viusal studio 2005. This managed c++ dll calls native C++ methods of an SDK. When I referenced this managed c++ library in a console applciation...
7
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I have a C# logging assembly with a static constructor and methods that is called from another C# Assembly that is used as a COM interface for a VB6 Application. Ideally I need to build a file...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.