473,399 Members | 3,832 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,399 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 3795
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.