“NativeMagickSettings”的类型初始值设定项引发异常。“X64”的类型初始值设定项引发异常。 #754
Replies: 8 comments 3 replies
-
What is the exception? Can you view the exception that was raised? |
Beta Was this translation helpful? Give feedback.
-
“An exception was thrown by the type initializer of nativemaicksettings'. #The type initializer for 'x64' threw an exception。#Magick.NET-Q16-AnyCPU# 在 ImageMagick.MagickSettings.NativeMagickSettings..ctor()
在 ImageMagick.MagickSettings..ctor()
在 ImageMagick.MagickImage..ctor()
在 ZonLian.Common.DLL.ImageHelp.SaveImage(Stream vImageStream, String vImageSavePath) 位置 E:\SVN\ZonLian\developer\ZonLian.Common\ZonLian.Common.DLL\ImageHelp.cs:行号 31
the code :
/// <summary>
/// 保存图片
/// </summary>
/// <param name="vImageStream"></param>
/// <param name="vImageSavePath"></param>
/// <returns></returns>
public ResBase SaveImage(Stream vImageStream,string vImageSavePath)
{
#region
ResBase result = new ResBase()
{
retCode = ResCodeEnum.failed,
retMsg = "操作失败"
};
try
{
MagickImage image = new MagickImage(vImageStream);
image.Write(vImageSavePath);
result.retCode = ResCodeEnum.success;
result.retMsg = "操作成功";
image.Dispose();
}
catch(MagickErrorException aex)
{
result.retCode = ResCodeEnum.exception;
result.retMsg += JsonHelp.ObjectConvertJsonString(aex);
}
catch (MagickException aex)
{
result.retCode = ResCodeEnum.exception;
result.retMsg += JsonHelp.ObjectConvertJsonString(aex);
}
return result;
#endregion
}
The recorded exception information is the code above and then executed
…------------------ 原始邮件 ------------------
发件人: "dlemstra/Magick.NET" <[email protected]>;
发送时间: 2020年10月10日(星期六) 下午5:29
收件人: "dlemstra/Magick.NET"<[email protected]>;
抄送: "曲凡"<[email protected]>;"Author"<[email protected]>;
主题: Re: [dlemstra/Magick.NET] “NativeMagickSettings”的类型初始值设定项引发异常。“X64”的类型初始值设定项引发异常。 (#754)
What is the exception? Can you view the exception that was raised?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
-
It's strange that the same code configures two sites on an IIS on the same server. One site can execute normally, and the other site has an exception. Then I set the 32-bit application in the advanced settings of IIS application pool of the site with exception as true, and the abnormal site can execute normally.
…------------------ 原始邮件 ------------------
发件人: "dlemstra/Magick.NET" <[email protected]>;
发送时间: 2020年10月10日(星期六) 下午5:29
收件人: "dlemstra/Magick.NET"<[email protected]>;
抄送: "曲凡"<[email protected]>;"Author"<[email protected]>;
主题: Re: [dlemstra/Magick.NET] “NativeMagickSettings”的类型初始值设定项引发异常。“X64”的类型初始值设定项引发异常。 (#754)
What is the exception? Can you view the exception that was raised?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
-
I'll try as you say
thank you very much !!!
…------------------ 原始邮件 ------------------
发件人: "dlemstra/Magick.NET" <[email protected]>;
发送时间: 2020年10月10日(星期六) 晚上6:10
收件人: "dlemstra/Magick.NET"<[email protected]>;
抄送: "曲凡"<[email protected]>;"Author"<[email protected]>;
主题: Re: [dlemstra/Magick.NET] “NativeMagickSettings”的类型初始值设定项引发异常。“X64”的类型初始值设定项引发异常。 (#754)
You probably want to use MagickAnyCPU.CacheDirectory (https://github.com/dlemstra/Magick.NET/tree/27b6e2cea8a6c60af7c73c4c384ed084ee3e020c/docs#anycpu) and point to a different folder for each site. Another option would be to use MagickAnyCPU.HasSharedCacheDirectory but it is very likely that I will remove that from the API very soon.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
-
Cache directory intelligent settings C disk under the directory?
…------------------ 原始邮件 ------------------
发件人: "dlemstra/Magick.NET" <[email protected]>;
发送时间: 2020年10月10日(星期六) 晚上6:10
收件人: "dlemstra/Magick.NET"<[email protected]>;
抄送: "曲凡"<[email protected]>;"Author"<[email protected]>;
主题: Re: [dlemstra/Magick.NET] “NativeMagickSettings”的类型初始值设定项引发异常。“X64”的类型初始值设定项引发异常。 (#754)
You probably want to use MagickAnyCPU.CacheDirectory (https://github.com/dlemstra/Magick.NET/tree/27b6e2cea8a6c60af7c73c4c384ed084ee3e020c/docs#anycpu) and point to a different folder for each site. Another option would be to use MagickAnyCPU.HasSharedCacheDirectory but it is very likely that I will remove that from the API very soon.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
-
I now use the root directory of the current program's execution as the cache directory, but it doesn't seem to have any effect. Its cache or go to the C:/Windows/Temp directory
…------------------ 原始邮件 ------------------
发件人: "dlemstra/Magick.NET" <[email protected]>;
发送时间: 2020年10月10日(星期六) 晚上6:10
收件人: "dlemstra/Magick.NET"<[email protected]>;
抄送: "曲凡"<[email protected]>;"Author"<[email protected]>;
主题: Re: [dlemstra/Magick.NET] “NativeMagickSettings”的类型初始值设定项引发异常。“X64”的类型初始值设定项引发异常。 (#754)
You probably want to use MagickAnyCPU.CacheDirectory (https://github.com/dlemstra/Magick.NET/tree/27b6e2cea8a6c60af7c73c4c384ed084ee3e020c/docs#anycpu) and point to a different folder for each site. Another option would be to use MagickAnyCPU.HasSharedCacheDirectory but it is very likely that I will remove that from the API very soon.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
-
I have set the permission to write to other directories, but it still has no effect. Can you solve this problem in the next version?
…------------------ 原始邮件 ------------------
发件人: "dlemstra/Magick.NET" <[email protected]>;
发送时间: 2020年10月10日(星期六) 晚上7:33
收件人: "dlemstra/Magick.NET"<[email protected]>;
抄送: "曲凡"<[email protected]>;"Author"<[email protected]>;
主题: Re: [dlemstra/Magick.NET] “NativeMagickSettings”的类型初始值设定项引发异常。“X64”的类型初始值设定项引发异常。 (#754)
Your program needs write access to that directory. I would advise you to use a different folder than the root of your program.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
-
Now I find a temporary solution, which is to set the application pool of two sites to the same in "IIS". That's it. But I still want to see if it can be fundamentally solved!
…------------------ 原始邮件 ------------------
发件人: "dlemstra/Magick.NET" <[email protected]>;
发送时间: 2020年10月10日(星期六) 晚上7:33
收件人: "dlemstra/Magick.NET"<[email protected]>;
抄送: "曲凡"<[email protected]>;"Author"<[email protected]>;
主题: Re: [dlemstra/Magick.NET] “NativeMagickSettings”的类型初始值设定项引发异常。“X64”的类型初始值设定项引发异常。 (#754)
Your program needs write access to that directory. I would advise you to use a different folder than the root of your program.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
-
ERROR: The type initializer of "NativeMagickSettings" throws an exception. The type initializer for 'x64' threw an exception.
This is run in net framework 4.5.2. This error will be reported when calling the DLL. What is the cause? How to solve this problem?
Beta Was this translation helpful? Give feedback.
All reactions