简体   繁体   中英

C# XMLSerializer temp directory problems

I have a C# console app invoked from a SQL Server Agent job.

The process runs as a network account I created.

Originally I got errors because the serializer ws trying to write to another user's temp directory (the account for the SQL Server Agent service itself), but I fixed that using the config setting

 <system.xml.serialization>
      <xmlSerializer tempFilesLocation="c:\\temp"/>
 </system.xml.serialization>

However now I get the error "Unable to generate a temporary class (result=1).

error CS0016: Could not write to output file 'c:\temp\2euqs4ou.dll' -- 'Access is denied. ' " 

Both the accounts have full control over c:\\temp. I'm stumped.

I've been Googling this all day now with no success. I am resisting making the service account a machine admin, but I will if I have to.

Why not pre-generate the XmlSerializer assemblies with sgen.exe ?

sgen.exe /assembly:MyFile.dll

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM