views:

80

answers:

1

Hi,

I have a web service that does not use any xml attributes for serialization. I just return a string from the web service. In this case, does a serialization dll get created?

The reason I ask is I keep seeing c:\windows\temp\xxxxx.dll (where xxxxx is a random sequence of characters) every couple of weeks the web service is running. One solution is to pre-compile using sgen.exe and that might solve the problem.

Also, I saw a link that said only do this for client side libraries, but this error is on the web service side (server side), so can I still use sgen.exe?

JD

+1  A: 

Every time you call the XmlSerializer constructor it will check the type you are trying to serialize and it will generate a temporary assembly. If the assembly already exists it will reuse it. So if your web service is a classic ASMX service it will use XmlSerializer on every request, no matter the return type. These temporary assemblies are part of the serialization process and in my opinion you shouldn't worry too much about them.

Darin Dimitrov
Thanks Darin. So sgen.exe will not help avoid the error? I was thinking about changing the application pool recycle period from the default 29 hours to about 15 hours and see if that has any effect.
JD
@JD, you say that you see all these temporary assemblies generated in the temp folder but you didn't mention anything about errors?
Darin Dimitrov
@Darin: After a couple of weeks, each web service generates an error "System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.IO.FileNotFoundException: Could not find file 'c:\windows\Temp\xxxxxx.dll'" where xxxxx changes on each request. I posted this a while back : http://stackoverflow.com/questions/1682425/web-service-error-that-has-occurred-several-times
JD
@Darin: You said that the xmlSerializer is called on every request. I thought it was only done on the first request and then it was cached?
JD
`XmlSerializer` is instantiated on every request, but it will reuse the temporary assembly generated on previous requests.
Darin Dimitrov
@Darin: Okay, thanks. Any ideas on my previous reply regarding a previous post.
JD