请教各位,小弟写了一个利用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能被加載,求高人指點!

解决方案 »

  1.   

    對不起,錯誤提示貼錯了,應該是下面的提示: 
    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