It appears our application has an assembly leak. I noticed that on any calls where a web service call is invoked using the HttpWebRequest object a dynamic assembly is loaded on the call httpWebRequest.GetResponse()
I can see the assembly get loaded through the debugger ('w3wp.exe' (Managed): Loaded '7-6jav6v', No symbols loaded.) but I cannot figure out why this would occur.
Has anyone else experienced this before?
Edit: To add clarifications to this question. In c# when you create an XmlSerializer an assembly is created to complete the serialization. This always will occur unless you use a tool to do this for you in advance. If you use the constructor of (Type type) or (Type type, string "namespace") then only 1 assembly will be generated. If you use any other constructor then a new assembly will be generated for each serialization.
THis is not the case in the problem stated above.
There is a block of code in our codebase that manually makes a soap call and returns a string (the string is xml, ex: ). Each time this block of code executes a new assembly gets created. When examining one of these assemblies this is referenced "XmlSerializationWriter1.Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.XmlSerializer1.ArrayOfObjectSerializer.ArrayOfObjectSerializer1.ArrayOfObjectSerializer2"
For a better understanding - the code block looks like below and when the last line executes the assembly gets generated...multiple assemblies, one for each time this block runs.
HttpWebRequest oHttpWebRequest =(HttpWebRequest)WebRequest.Create("URL TO WEBSERVICE");
oHttpWebRequest.Timeout =((1000*60)*30);
oHttpWebRequest.Method ="POST" ;
oHttpWebRequest.ContentType ="text/xml" ;
oHttpWebRequest.Headers.Add("SOAPAction: http://www.tempuri.com/"+WebMethodName);
StreamWriter oStreamWriter = new StreamWriter(oHttpWebRequest.GetRequestStream()) ;
string SoapRequest=@"<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/""><soap:Body>";
SoapRequest=SoapRequest + HttpUtility.HtmlDecode(XmlHttpRequestData);
SoapRequest=SoapRequest + @"</soap:Body></soap:Envelope>";
oStreamWriter.Write(SoapRequest);
oStreamWriter.Close();
oHttpWebRequest.ProtocolVersion.Build;
WebResponse oWebResponse = oHttpWebRequest.GetResponse() ;