webserive中方法为
public class WebService : System.Web.Services.WebService
{ public WebService()
{ //如果使用设计的组件,请取消注释以下行
//InitializeComponent();
} [WebMethod]
public string HelloWorld()
{
return "Hello World";
}}
CLR中为
public class SqlProduce1
{
[Microsoft.SqlServer.Server.SqlProcedure]
public static void helloworld1()
{
localhost.WebService webservice1 = new localhost.WebService();
webservice1.HelloWorld();
}
}在属性中"生成"--->"生成序列化程序集"-->"开"数据库-->"权限级别"-->"安全"在SQLSERVER程序集中加载了helloworld.XmlSerializers运行时启用了CLR出现错误为
消息 6522,级别 16,状态 1,过程 helloworld1,第 0 行
在执行用户定义例程或聚合 'helloworld1' 期间出现 .NET Framework 错误:
System.Security.SecurityException: Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
System.Security.SecurityException:
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.Net.HttpWebRequest..ctor(Uri uri, ServicePoint servicePoint)
at System.Net.HttpRequestCreator.Create(Uri Uri)
at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)
at System.Net.WebRequest.Create(Uri requestUri)
at System.Web.Services.Protocols.WebClientProtocol.GetWebRequest(Uri uri)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest(Uri uri)
at System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest(Uri uri)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at helloworld.localhost.WebService.HelloWorld()
at helloworld.SqlProduce1.helloworld1()
。(1 行受影响)在Microsoft .NET Framework 2.0 配置全部设置权限为Fulltrust
在控制台中 Caspol -s off
还是出现了该问题,请问如何解决!!!
public class WebService : System.Web.Services.WebService
{ public WebService()
{ //如果使用设计的组件,请取消注释以下行
//InitializeComponent();
} [WebMethod]
public string HelloWorld()
{
return "Hello World";
}}
CLR中为
public class SqlProduce1
{
[Microsoft.SqlServer.Server.SqlProcedure]
public static void helloworld1()
{
localhost.WebService webservice1 = new localhost.WebService();
webservice1.HelloWorld();
}
}在属性中"生成"--->"生成序列化程序集"-->"开"数据库-->"权限级别"-->"安全"在SQLSERVER程序集中加载了helloworld.XmlSerializers运行时启用了CLR出现错误为
消息 6522,级别 16,状态 1,过程 helloworld1,第 0 行
在执行用户定义例程或聚合 'helloworld1' 期间出现 .NET Framework 错误:
System.Security.SecurityException: Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
System.Security.SecurityException:
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.Net.HttpWebRequest..ctor(Uri uri, ServicePoint servicePoint)
at System.Net.HttpRequestCreator.Create(Uri Uri)
at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)
at System.Net.WebRequest.Create(Uri requestUri)
at System.Web.Services.Protocols.WebClientProtocol.GetWebRequest(Uri uri)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest(Uri uri)
at System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest(Uri uri)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at helloworld.localhost.WebService.HelloWorld()
at helloworld.SqlProduce1.helloworld1()
。(1 行受影响)在Microsoft .NET Framework 2.0 配置全部设置权限为Fulltrust
在控制台中 Caspol -s off
还是出现了该问题,请问如何解决!!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货