search web part security error net 2008 search server express


C

cindy

I am trying to build a web part search box for search server 2008 express
using net 2008 I created web control implements web part not deployed to gac
it has been added as safe control to web config and dll with pdb are in
C:\Inetpub\wwwroot\wss\VirtualDirectories\881\bin

To AssemblyInfo.cs I have added
using System.Security;
and
[assembly: AllowPartiallyTrustedCallers]

I have also added additional web.config inside the application with
<system.web>
<trust level="Full" originUrl="" />

when code executes at
line kRequest = new KeywordQuery(ServerContext.Current);
I get this error How do I fix?

System.Security.SecurityException was unhandled
Message="Request for the permission of type
'System.Security.Permissions.RegistryPermission, mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
Source="mscorlib"
StackTrace:
at System.Security.CodeAccessSecurityEngine.Check(Object demand,
StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at Microsoft.Win32.RegistryKey.CheckSubKeyReadPermission(String
subkeyName)
at Microsoft.Win32.RegistryKey.CheckOpenSubKeyPermission(String
subkeyName, Boolean subKeyWritable)
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean
writable)
at Microsoft.Win32.RegistryKey.OpenSubKey(String name)
at Microsoft.Office.Server.Search.Query.CommandCreator..ctor()
at
Microsoft.Office.Server.Search.Query.Query.FinishConstruction(String appName)
at Microsoft.Office.Server.Search.Query.Query..ctor(ServerContext
serverContext)
at
Microsoft.Office.Server.Search.Query.KeywordQuery..ctor(ServerContext
serverContext)
InnerException:
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top