Re: The annoying VSTO 2003 message "The current .NET security policy does not permit....."



I found the problem and was able to get rid of this annoying message
after several trial and error methods.

Here's what I did:

In the VSTO for Excel project I created using VS .NET 2003 (Framework
V1.1.4322), I have one project dll and one template Excel file. The
project dll, by default, resides inside a folder with this structure
"<templateExcelfileName>_bin". So, in my case it was "Chart_bin" and
the name of my template Excel file is Chart.xls.

I copied this folder and the template Excel file into another test
server within the c:\inetpub\wwwroot\ExcelProject\Charts folder. And
ExcelProject is also set as a virtual directory in IIS.

So now, within the Charts folder I have a sub-folder called Chart_bin
and a file called Chart.xls. Within the Chart.xls file, and within the
File/Properties/Custom menu, the assembly name and location are the
default set by VSTO when I created the project in VSTO 2003. I DID NOT
modify this in the Excel template file. So, if you look at the settings
in the Excel file, the location of the dll would point to ".\Chart_bin"
and the name of the dll, in my case, would be "Chart" without the
".dll" extension.

Now, you'll have to make ABSOLUTELY sure in IIS that the Execute
Permission within the Application settings section for the "Charts"
folder is set to "Scripts Only". You can do this by opening IIS from
control panel-administrative tools and by right-clicking on the Charts
folder within your ExcelProject virtual directory and by clicking on
the properties menu item. Remember, you are doing these on the test
computer/server.

Now, on the "end-user" machine, not the test machine, from where you
want to test this application, you'll need to have IIS, .NET framework
1.1.4322 installed, MS Office 2004 installed with the PIAs (Primary
Interop Assembly) for .NET selected during installation. This
installation should and must happen in the same order given.

Once this is completed, Go to Control Panel, Administrative Tools and
open Microsoft .NET Framework 1.1 Configuration and follow these steps.
Please note that the end-user computer can be either on the intranet or
the Internet. Depending on where the end-user computer is, your setting
in this configuration dialog box changes. My assumption here is that
the end-user computer is on the Internet and it has access to the test
computer that hosts the dll and the excel template file.

1. Double-Click on the My Computer tree item in this dialog box.
2. Click on the "+" next to the Runtime Security Policy
3. Click on the "+" next to Machine.
4. Click on the "+" next to Code Groups.
5. Click on the "+" next to All Codes.
6. Click on the "+" next to Internet_Zone.
7. Right-Click on Internet_Zone and click on New.
8. Give any name, doesn't matter what is is, but lets say it is Charts.
9. Click Next and from the drop-down select the URL option.
10. Enter http://testserveraddress/ExcelProject/Charts/* (This is the
address in my case) in the test box displayed below the drop-down. Note
that I'm pointing the URL to the Charts folder where the Chart_bin and
the Excel Template file reside.
11. Click Next, Select Full Trust if not already selected and Click on
Finish.
12. Now, a new tree-item called "Charts" would have been created under
the Internet_Zone tree item.
13. Now, right-click the "Charts" tree item and click on New
14. Eneter any name, but let's say ChartDll
15. Click Next and select URL from the drop-down,
16. Enter
http://testserveraddress/ExcelProject/Charts/Chart_bin/Chart.dll (This
is the address in my case) in the test box displayed below the
drop-down. Note that I'm pointing to the dll within the Chart_bin
directory.
17. Click Next, Select Full Trust if not already selected and Click on
Finish.
18. Close the Configuration tool.

Now, from the end-user computer, open the browser and type
http://testserveraddress/ExcelProject/Charts/Chart.xls. In a computer
that had 2 GB ram, the chart open within 5 seconds. But with lower
memory computers, the chart took about a couple of minutes to open.
Also, if it takes a long time, the browser may freeze, but do not
worry, eventually Excel will open. However, the irritating message that
says, "The current .NET security policy does not permit..." will
disappear.

If it still appear, then either you have more than 1 dll file that you
are referencing in your project. But if you follow the instructions
stated above, it WILL work..

Thank you
bsriniva

bsriniva wrote:
I need some serious help please. I keep getting this annoying message
"The current .NET security policy does not permit............" when I
deploy my VSTO 2003 project dll in a test machine and try to run it
from the browser. The browser actually calls an Excel file which inturn
call the dll. The dll propoerties are correctly set in the Excel
Template file within the File/Properties/Custom tab. Please note that
when I double-click the Excel file from the hard drive folder,
everything works fine.

I tried all the different security settings in the .NET 1.1
configuration tool (Trust me, you name a setting, I've tried it) and
none of them seem to help. I invariably get the same message.
[FullTrust has been given to the assembly from the machine where I'm
calling the assembly from]. I even have tried adjusting my browser
settings.

Can someone please help. I've tried all sorts of blogs, web sites,
microsofts suggessted security settings and none of them seem to help.
It's driving me nuts and I have a deadline that is approaching soon.

HELP PLEASE!!!
Bsriniva

.



Relevant Pages

  • Re: The annoying VSTO 2003 message "The current .NET security poli
    ... You have to add a new project to you're solution that will create a dll. ... I have one project dll and one template Excel file. ... within the Charts folder I have a sub-folder called Chart_bin ... Interop Assembly) for .NET selected during installation. ...
    (microsoft.public.vsnet.vstools.office)
  • Re: The annoying VSTO 2003 message "The current .NET security poli
    ... You have to add a new project to you're solution that will create a dll. ... I don't know if you have the book of VSTO but if you are thinking of realy ... I have one project dll and one template Excel file. ... within the Charts folder I have a sub-folder called Chart_bin ...
    (microsoft.public.vsnet.vstools.office)
  • Re: System.Security.SecurityException: Permission denied Error while invoking methods in a Component
    ... I have a DLL given to me by ... by the security policy. ... sourceControl, String eventArgument) +18 ... I am getting an error while trying to create an excel file. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: excel charts and powerpoint
    ... I am cutting and pasting the charts into powerpoint so I can still access ... "The whole Excel file is embedded inside your presentation. ... PPT, you can still doubleclick to edit the spreadsheet data. ...
    (microsoft.public.powerpoint)
  • Re: Error 1004 - unable to set the hastitle property of the axis c
    ... Paste in two charts, that's two copies of the workbook. ... message when producing a lot of graphs in one Excel file and found this ... I followed the directions and did the macro fix and the registry fix, ...
    (microsoft.public.excel.programming)

Loading