I have system which runs self standing asmx web service on desktop (I have simple web service web server implemented with http.sys, modified version of system described in http://msdn.microsoft.com/msdnmag/issues/04/12/ServiceStation/default.aspx).
This system works just fine with simple web methods in my service, calling for example methods from my other custom assemblies etc. But now, when I add web reference to another web service (AXIS 1.2RC3, running on tomcat), I got exception when calling webmethod that deals with creation of proxy instance to my AXIS service.
That AXIS web service has been throughly tested and there should be no problems on it (I have created basic windows form application and added web reference to it and it works just fine).
Exception I get is:
System.IO.FileNotFoundException occurred
Message="Could not load file or assembly 'App_WebReferences.XmlSerializers, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Maaritettya tiedostoa ei loydy."
Source="mscorlib"
FileName="App_WebReferences.XmlSerializers, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"
FusionLog=""
StackTrace:
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
I get this error when I call HttpRuntime.ProcessRequest in my own 'web service server' application to process request to invoke that web method.
It clearly seems to be assembly related and there surely is some simple solution to this, but as I have usually used static libraries in my earlier projects and not have been working much with C# earlier I just can't realize what it is.
I use VS .NET 2005 Team Edition Beta 2 and .NET framework 2.0. As programming language I use C#.

FileNotFoundException while calling web service from web service
ManishaPatil
As detailed above (thank you both), this is an internal exception in the XmlSerializer. You only see it if you have your 'Break on Exception Thrown' (on menu, Debug/Exceptions) checked. Instead of showing you where the exception was thown inside the XmlSerializer code, VS shows the error against the call in your own call which is what causes the confusion.
To 'work-around' it simply uncheck the break on exception checkbox for 'c0000142 DLL Initialization Failed' (under Win32 exceptions) and the problem goes away. If this does not work, resetting all exception handlers (to unchecked status) will fix the problem.
If you are debugging a real DLL initialisation failure and need to force a break on this error elsewhere in you project, you will probably have to place break points before and after each web service call to enable you to manually uncheck the 'break on thrown' before the call and re-enable it afterwards. Seems a bit poor to me (can't think of why VS is unable to automatically ignore handled exceptions in non-servicable System modules like XmlSerializer where it is unable to display the code where the exception is thrown).
Sniper167
The excpetion is side effect of the new XmlSerilaizer feature allowing to re-generate serialization assemblies at design time and re-use them at the run time. There is a new tool (sgen.exe) shipping with Whidbey SDK allowing pre-generate the assemblies. See http://msdn.microsoft.com/library/default.asp url=/library/en-us/dnvs05/html/wsnetfx2.asp for more information.
Thanks,
Elena
Brian Tucker
My issue was slightly different, the FileNotFoundException occurred when I attempted to send an object to MSMQ.
I couldn't locate myProject.XmlSerializers.dll at all. Setting the "Generate Serialization Assembly" to On still yielded no results, so i ran sgen on the my assembly manually; turns out sgen was erring.
I actually had 2 classes by the same name in different namespaces in my code (yes, not a really good idea but the code in question is a complicated business object in the middle of a data model makeover); since I hadn't specified a [XmlRoot(Namespace="xxx")] on either of my classes, sgen was erring because there wasn't a specific xml type name for either class. Specifying the namespace resolved my issue.
TillmanJ
Sorry, I'm afraid I know no more than you.
Only just got them working myself. This forum was helpful though, but it's not always realistic to get a neat solution in prompt reply. 3 people have come up with solutions or work arounds to the problem originally posted. Hopefully someone will have some more suggestions regarding your specific issue soon.
It's also probably best to continue to google the question in various forms in case you stumble across a solution that has already been provided for someone who has previously had this problem. That's how I found this forum - eventually. I know it's frustrating though.
Ron DeSerranno - MOBIFORM
Might Elena Kharitidi's suggestion above help. The tool she talks about seems to be concerned with pre-compiling, and I'm guessing, might avoid the run-time compiling which seems to be causing the problem.
Assuming you have checked the obvious folder/file permissions, it might also be worth checking for any group policy restrictions that might impact on local rights to create files. I'm afraid this is not my area so I can't advise you specifically but I have often been caught out in a network environment by unexpected group policy restrictions.
Good luck,
Matt.
David Boone220659
Hello.
I have a similar error as you describe above in my application (that is a shared com addin developed for word, outlook and excel).
My problem is that the code works fine on the machine I'm developing on (this machine is NOT on a domain) both in debug and release mode. It does not work on the machine without Visual Studio 2005 that is on a companys domain. This is the kind of machine the users have.
On the machine where the error occurs the code runs successfully in ms outlook. In word and excel I get the xmlserializer error. I read somewhere that the xmlserializer has to compile some code runtime and has to write to a tempfile temporarily. This could cause permission problems.... If this is the case - how do I workaround this. The error is happening in code I'm inheriting from...
The errors occur when trying to create the proxy object (calling the reference.cs that is generated by Visual Studio when creating the webservice reference). Below is the stack trace from my error (the error is Unknown -1):
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at System.IO.FileStream.Compiler.TempFileCollection.EnsureTempNameCreated()
at System.IO.FileStream.Compiler.TempFileCollection.AddExtension(String fileExtension, Boolean keepFile)
at System.IO.FileStream.Compiler.TempFileCollection.AddExtension(String fileExtension)
at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.*CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources)
at System.codeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(CompilerP*arameters options, String[] sources)
at System.Xml.Serialization.TEmpAssembly.GenerateAsse mbly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, CompilerParameters parameters, Assembly assembly, Hashtable assemblies)
at System.Xml.Serialization.TempAssembly..ctor(XmlMap ping[] xmlMappings, Type[] types, String defaultNAmespace, String location, Evidence evidence)
at System.Xml.Serialization.XmlSerializer.FromMapping s(XmlMapping[] mappings, Type type)
at System.Web.Services.Protocols.SoapClientType..ctor (Type type)
at System.Web.Services.Protocols.SoapHttpClientProtoc ol..ctor()
Please help me out :) I'm getting pretty frusrated...
Chaepp
In Visual Studio 2005 there is now a setting on the Project property pages under "Build" which allows you to specify that you want to create the strongly typed serializer classes at compile time. The defaul value of the property is "Auto" which means that the serializer will be only generated for retail build. You can chang the setting to make sure that the serializer is always generated.
Thanks,
Elena
_Stoic
By generating source code for proxy with that and importing it to my web service project, it worked out just fine.
mteverest
ksona
Thanks, this sounds like a very good fix.
(It also seems to suggest that a configuration option somewhere will probably cause this file to be created during debug builds resolving the underlying issue.)
Batistuta
I am facing the same problem here, did you manage to subside this problem
would love to know how.
Thanks in advance.
XNA Rockstar
Hi there...
Now I've made sure the xmlserializer.dll is installed in the same folder as the running dll..... This should - according to what I've read about the sgen tool - be sufficient.
I've also checked the folder/file permissions... But - how can I be sure of which folder the code tries to access I've made sure every temp folder on the c drive has given full permission to all groups and user names listed. Is that enough Do I have to give permission to the thread my code has How do I do that... Oh - I'm getting pretty confused.
I'll be happy for any suggestions you might have :) And, if you don't have any further contributions, please help me find a proper forum... I thought this one should be the right one.
ravi_nilesh
Please post a new thread including the details of your problem. It's possible that your problem is different even though it may appear the same.