473,242 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,242 software developers and data experts.

SecurityException Request Failed Reflection

I'm loading a strong named assembly using reflection through auto-deploy. The
code that loads the strong named assembly is compiled at runtime. The strong
named assembly gets downloaded to the Download Cache. I can create an instace
of the assembly's class and call its methods in my program. When I re-load
the same assembly and try to create an instace of the same class again, I
recieve
a SecurityException with the message Request Failed.

Does anyone know of this behavior?
Jul 21 '05 #1
13 3783
Hi

We have reviewed this issue and are currently researching on it. We will
update you ASAP. Thanks for your patience!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #2
Hello,

As I understand, if the code is not compiled at runtime, it can load the a
strong named assembly (in download cache) successfully. Is this right? Or
the error only occur when it was called second time? Have you try to load
another strong named assembly with same code? for example, you can create a
test assembly only with a simple method for test.

Luke

Jul 21 '05 #3
I further tested problem and here is my current set up.
I have a Smartclient exe that compiles a class X dynamically and runs a
mathod of X in a separate thread.
The X's method starts a async call and in the call back function, it tries
to create an instance of a strong named dll (by using reflection. Dll is
located in the web server). There is a security policy set for the stong name
and it is full trust.

Now,
If I run the X's method in the same thread then I don't get the problem and
if I set the full trust to url (not to strong name), I don't have the
problem. If I create an instance of this dll in the X's method, I don't have
any problem (but then I can't refer to the object in the call back function).

"[MSFT]" wrote:
Hello,

As I understand, if the code is not compiled at runtime, it can load the a
strong named assembly (in download cache) successfully. Is this right? Or
the error only occur when it was called second time? Have you try to load
another strong named assembly with same code? for example, you can create a
test assembly only with a simple method for test.

Luke

Jul 21 '05 #4
So, the problem only occur when your security policy (full trust) is with
the dll's strong name, not its url. Is this right? Have you tried to create
a simple DLL instead of this strong name dll and test again? If the problem
even occur with a simple DLL, can you provide some sample code which can
reproduce the problem? I can try it on my side and try to find what is
going on.

Luke

Jul 21 '05 #5
Yes, please remove "online." from my email to get actual one.

Thanks,

Luke

Jul 21 '05 #6
Hello,

Thank you for the code. With it, I have reproduced the problem. And I aslo
try to trust this assembly in Microsoft .NET Framework Wizard. Following is
what I have done:

1. Click "Trust an Assembly" in the wizard
2. Select "Make Changes to this computer"
3. Type "http://YourServer/ExeFolder/myVBCompiler.exe" for the Url
4. Select "All assemblies with the same assembly public key.
5. Grant Full trust permission.

After above steps, the assembly seems to be working.

Is this same with yours?

Luke
Jul 21 '05 #7
Luke,
I tried your suggestion but still getting the same exception.
Do see any problem in our logic?
"[MSFT]" wrote:
Hello,

Thank you for the code. With it, I have reproduced the problem. And I aslo
try to trust this assembly in Microsoft .NET Framework Wizard. Following is
what I have done:

1. Click "Trust an Assembly" in the wizard
2. Select "Make Changes to this computer"
3. Type "http://YourServer/ExeFolder/myVBCompiler.exe" for the Url
4. Select "All assemblies with the same assembly public key.
5. Grant Full trust permission.

After above steps, the assembly seems to be working.

Is this same with yours?

Luke

Jul 21 '05 #8
Hello,

I found the exception occur at following lines:

objReturnARUtil1 = ReferToUtil("http://orange/myUtilTester/myUtil.dll",
"myUtil.myUtilClass")
...
objReturnARUtil = System.Activator.CreateInstance(formtype)

For trouble shooting, I create another simple class instead of
"myUtil.myUtilClass". After this, it seems to work. However, when I double
check it, I found I ignored following line for the simple test class:

<Assembly: AssemblyKeyFile("..\..\..\mykeyfile.snk")>

It seems it will work if we don't use same strong name for the assemblies.

Luke

Jul 21 '05 #9
For a simple class, omitting that line works but for a class that needs
permissions to execute, it's not going to work. So I would really want to
have strong naming with this assembly.
Do you have any suggestions? Or a way to change our logic but retain the
functionality?
"[MSFT]" wrote:
Hello,

I found the exception occur at following lines:

objReturnARUtil1 = ReferToUtil("http://orange/myUtilTester/myUtil.dll",
"myUtil.myUtilClass")
...
objReturnARUtil = System.Activator.CreateInstance(formtype)

For trouble shooting, I create another simple class instead of
"myUtil.myUtilClass". After this, it seems to work. However, when I double
check it, I found I ignored following line for the simple test class:

<Assembly: AssemblyKeyFile("..\..\..\mykeyfile.snk")>

It seems it will work if we don't use same strong name for the assemblies.

Luke

Jul 21 '05 #10
Hello,

Can you let know why you need objReturnARUtil1 here? I saw it didn't get
used after it was created in your code. Maybe this can help us to find a
work around.

Luke

Jul 21 '05 #11
In our real application objReturnARUtil is used. Of course it has some
functionality but since I can't even instantiate the class, I omitted the
usage of it. Even if we take out the code that instantiates the dll, I have
the same problem when I try to use the dummywebservice in the second thread.
(I tried this yesterday)
The DummyWebService class is instantiated, and we start an async call to
Method1 in the first thread (by calling beginMethod1). Then in the call back
function I'm calling endMethod1 to get the result. This also causes the
security exception. So I don't understand how one can use no touch
deployment, if we are to create a thread that will make async webservice
calls. I tried to pass the dummywebservice object as a parameter to callback
function (using Asycstate). But it still gives me the security exception.
"[MSFT]" wrote:
Hello,

Can you let know why you need objReturnARUtil1 here? I saw it didn't get
used after it was created in your code. Maybe this can help us to find a
work around.

Luke

Jul 21 '05 #12
I found a solution and it worked on my side. You may try it in your project:

In project myUtil, open AssemblyInfo.vb, add following line:

Imports System.Security
...
<Assembly: AllowPartiallyTrustedCallers>

And then rebuild the solution and update the fiiles on web server.

Here is the article about AllowPartiallyTrustedCallers:

http://support.microsoft.com/default...;EN-US;Q814669

Hope this help,
Luke
Jul 21 '05 #13
Great thank you Luke

"[MSFT]" wrote:
I found a solution and it worked on my side. You may try it in your project:

In project myUtil, open AssemblyInfo.vb, add following line:

Imports System.Security
...
<Assembly: AllowPartiallyTrustedCallers>

And then rebuild the solution and update the fiiles on web server.

Here is the article about AllowPartiallyTrustedCallers:

http://support.microsoft.com/default...;EN-US;Q814669

Hope this help,
Luke

Jul 21 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Vishal Dattani | last post by:
hi everybody, i am developing a project which is made up of three projects. 1) main project (presentation layer) 2) data access layer 3) business logic layer the main project references these...
0
by: normd | last post by:
I'm loading a strong named assembly using reflection through auto-deploy. The assembly gets downloaded to the Download Cache. I can create an instace of the assembly's class and call its methods in...
0
by: Chris Crowe [MVP 2005/2006] | last post by:
I have written a Web User Control that runs inside of Sharepoint, but when I want to use a custom convertor class to convert an XML attribute I get the following error: ...
0
by: Shree | last post by:
While invoking the web service from client, I am setting the credentitals using the following code... ReportingService.Credentials = System.Net.CredentialCache.DefaultCredentials; But in...
0
by: patrickinchicago | last post by:
Hi! I'm trying to debug a wcf service on a local machine, using a servicehost to create a service on localhost, and i'm getting a very unhelpful error the offending code is this : ...
0
by: Siberwulf | last post by:
I'm trying to fetch an XML document from a website through an assembly i built and attached to SQL 2005. Here is my code for the SPROC assembly: public static void fetch_FeedData(string...
5
by: Henry Stock | last post by:
I am trying to understand the following error: Any thing you can tell me about this is appreciated. Security Exception Description: The application attempted to perform an operation not allowed...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.