By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,516 Members | 1,369 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,516 IT Pros & Developers. It's quick & easy.

Calling C++ library from ASP.NET web service

P: n/a
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
Share this Question
Share on Google+
9 Replies


P: n/a

"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

P: n/a
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

P: n/a

"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

P: n/a
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

P: n/a

"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

P: n/a
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

P: n/a
<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

P: n/a
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

P: n/a

"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 discussion thread is closed

Replies have been disabled for this discussion.