首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

急救,ASP.NET C#网站在小弟我本机都生成且发布是OK的,但上传至网站服务器后却提示出错了!十二万分多谢

2012-03-23 
急救,ASP.NET C#网站在我本机都生成且发布是OK的,但上传至网站服务器后却提示出错了!请指教,十二万分谢谢!

急救,ASP.NET C#网站在我本机都生成且发布是OK的,但上传至网站服务器后却提示出错了!请指教,十二万分谢谢!
Security Exception 
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. 

Exception Details: System.Security.SecurityException: That assembly does not allow partially trusted callers.

Source Error: 


Line 59: </ItemTemplate>
Line 60: </asp:DataList>
Line 61: <webdiyer:aspnetpager ID="AspNetPager1" runat="server" CssClass="formfield" 
Line 62: CustomInfoClass="formbutton" 
Line 63: CustomInfoHTML="第&lt;font color='red'&gt;&lt;b&gt;%CurrentPageIndex%&lt;/b&gt;&lt;/font&gt;页 共%PageCount%&nbsp;页 %StartRecordIndex%-%EndRecordIndex%" 
 

Source File: d:\hosting\6589275\html\msk222\Productlist.aspx Line: 61 

Stack Trace: 


[SecurityException: That assembly does not allow partially trusted callers.]
  ASP.productlist_aspx.__BuildControlAspNetPager1() in d:\hosting\6589275\html\msk222\Productlist.aspx:61
  ASP.productlist_aspx.__BuildControlform1() in d:\hosting\6589275\html\msk222\Productlist.aspx:12
  ASP.productlist_aspx.__BuildControlContent1(Control __ctrl) in d:\hosting\6589275\html\msk222\Productlist.aspx:3
  System.Web.UI.CompiledTemplateBuilder.InstantiateIn(Control container) +12
  ASP.masterpage_master.__BuildControlhead() in d:\hosting\6589275\html\msk222\MasterPage.master:29
  ASP.masterpage_master.__BuildControlTree(masterpage_master __ctrl) in d:\hosting\6589275\html\msk222\MasterPage.master:1
  ASP.masterpage_master.FrameworkInitialize() in App_Web_masterpage.master.cdcab7d2.yxxvkspn.0.cs:0
  System.Web.UI.UserControl.InitializeAsUserControlInternal() +35
  System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +8682223
  System.Web.UI.Page.get_Master() +51
  System.Web.UI.Page.ApplyMasterPage() +15
  System.Web.UI.Page.PerformPreInit() +45
  System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785
  System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242
  System.Web.UI.Page.ProcessRequest() +80
  System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
  System.Web.UI.Page.ProcessRequest(HttpContext context) +49
  ASP.productlist_aspx.ProcessRequest(HttpContext context) in App_Web_productlist.aspx.cdcab7d2.ld2hza7e.0.cs:0
  System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
  System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

 


--------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.4216; ASP.NET Version:2.0.50727.4223 



我在product.aspx 页面中是采用了分页控件。

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>

我在单机上都运行没问题的! 而且我编译后上传上去的Bin目录中是存在 AspNetPager.dll 这个文件的。

但为啥上传至服务器上后却运行pooduct.aspx 页面则出现上面的错误呢? 
要如何解决,望高手指教,谢谢!

[解决办法]
看错误信息的话 好像是安全策略的问题吧!
------解决方案--------------------


1)服务器端:将客户端的访问权限设置为full trusted callers,可以正常使用服务器资源,但是咱们对服务器不能要求有什么改动,要求了提供商也是没反应

2)自身系统:我发现系统出现这个问题的地方都是因为用到了分页控件AspNetPager.dll,于是,想到有网友提议:

AssemblyInfo.cs文件中加如下内容

 

using System.Security;

 

[assembly: AllowPartiallyTrustedCallers()]

我想,是啊,突然间又想这个分页控件的新版本已经把这个问题解决了吧,这样我就不必自己修改AssemblyInfo.cs文件再重新编译生成AspNetPager.dll了。从网上又下了个AspNetPagerV7.02的,然后覆盖网站空间中原来那个,再打开自己的网页,发现问题解决了!
[解决办法]
Line 59: </ItemTemplate>
Line 60: </asp:DataList>
Line 61: <webdiyer:aspnetpager ID="AspNetPager1" runat="server" CssClass="formfield"
Line 62: CustomInfoClass="formbutton"
Line 63: CustomInfoHTML="第&lt;font color='red'&gt;&lt;b&gt;%CurrentPageIndex%&lt;/b&gt;&lt;/font&gt;页 共%PageCount%&nbsp;页 %StartRecordIndex%-%EndRecordIndex%"


Source File: d:\hosting\6589275\html\msk222\Productlist.aspx Line: 61
错误地址都给你贴出来了
[解决办法]
1、空间是否支持你的net版本?
2、你用的路径是否是相对于网站的根目录下的?
[解决办法]
http://www.jb51.net/codes/40809.html
怎么会下不到。 google收下
[解决办法]
直接去吴起哇的官网下载。还要啥分呢????www.webdiyer.com

热点排行