---
title: "发布网站，解决SecurityException"
author: "holoblog"
date: "2007-12-03T19:03:00Z"
tags: []
slug: "securityexception"
draft: false
lastmod: "2011-11-11T11:23:37Z"
id: 1252043
url: "https://holoblog.iteye.com/blog/1252043"
---

今天发布网站一直不顺。应用中含有Webservices的调用，本地发布成功，但是异地发布却是失败的。后来排除WebService的Url不匹配问题。结果程序还是报一下异常。

[SecurityException: Request for the permission of type'。。。'

解决方案是：在web.config文件中加入&lt;trust level="Full" /&gt;解决。

异地发布时，如果没有单独的ErrorPage,就要添加

&lt;customErrors mode="Off"/&gt;

如果报有can not find type in

&lt;section name="Microsoft.GravaMobile.WebSite.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt;

很有可能IIS上的网站设置选用的不是.net framework 2.0，这个在网站的属性里设置即可。

这里的异地发布是指，不再开发的机器上发布。