请教各位,小弟写了一个利用Skype提供的API(.dll)发送短信的程序,在VS2005上面运行很正常,也能发送短信,但是把它发布到IIS上面,访问的时候却出现了如下错误:
Server Error in '/' Application.
---------------------------------------------
Required permissions cannot be acquired.
Description: An unhandled exception occurred during the execution of the current Web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Security.Policy.PolicyException: Required permissions cannot be acquired.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace: [PolicyException: Required permissions cannot be acquired.]
System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission) +2738293
System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission) +57
[FileLoadException: Could not load file or assembly 'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +211
System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +141
System.Reflection.Assembly.Load(String assemblyString) +25
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +32我在网上查到有前辈指出是虚拟主机上修改了根web.config(在我电脑上其位置为C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG)的设置,虚拟主机自动设置了allowOverride为false,这就阻止了在用户web.config中重新定义权限的能力。然后,它定义trust level为High,而不是默认的Full。而只要trust level不为Full,仅被外部dll引用的其他外部dll就不能被加载。現在我的問題是怎樣修改才能讓我在外部引用的dll能被加載,求高人指點!
Server Error in '/' Application.
---------------------------------------------
Required permissions cannot be acquired.
Description: An unhandled exception occurred during the execution of the current Web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Security.Policy.PolicyException: Required permissions cannot be acquired.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace: [PolicyException: Required permissions cannot be acquired.]
System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission) +2738293
System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission) +57
[FileLoadException: Could not load file or assembly 'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +211
System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +141
System.Reflection.Assembly.Load(String assemblyString) +25
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +32我在网上查到有前辈指出是虚拟主机上修改了根web.config(在我电脑上其位置为C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG)的设置,虚拟主机自动设置了allowOverride为false,这就阻止了在用户web.config中重新定义权限的能力。然后,它定义trust level为High,而不是默认的Full。而只要trust level不为Full,仅被外部dll引用的其他外部dll就不能被加载。現在我的問題是怎樣修改才能讓我在外部引用的dll能被加載,求高人指點!
解决方案 »
- 如何实现在GridView中录入信息呢
- 急急急!在线等。DLL参数传递。C# []string传递到C++ DLL string[].怎么传啊?
- 如何合并DataSet中两个Table表,再插入到数据库中?急啊!
- 【求助】如何得到当前日期是今年的第几周?
- 请问进程名字是不是就是文件的名字啊`我想确认一个程序是否运行,应该怎么样判断了?
- 谁能帮我看下这个传真函数,是什么问题
- .net流里面有没有这种事件?
- 如何在运行时候得到dll的路径
- 有没有好的方法生成C#调用WindowsAPI的声明
- 发展方向
- 有谁在企业做发短信的呀?问问是不是一般都在用短信猫?谁可以提供下发短信的程序,谢谢
- 在线等,窗体问题,一个主窗体,打开了多个子窗体,如何调用激活窗体的一个事件!
Server Error in '/fullpower' Application.
-------------------------------------------------------------------------------- Wait timeout.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: Wait timeout. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
[COMException (0x80040201): Wait timeout.]
SKYPE4COMLib.SkypeClass.SendSms(String TargetNumbers, String MessageText, String ReplyToNumber) +0
Default2.Button1_Click(Object sender, EventArgs e) +1030
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42