开发者

C# XMLSerializer temp directory problems

开发者 https://www.devze.com 2023-04-11 14:44 出处:网络
I have a C# console app invoked from a SQL Server Agent job. The process runs as a network account I created.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消