Cannot access assembly from end user computer  
Author Message
NCAnand





PostPosted: Visual Studio Tools for Office, Cannot access assembly from end user computer Top

I am creating a simple excel application and saving the assembly on a
network folder. When i try to access this from end user's machine i get
the

"The Current .Net Security policy does not permit the customization to
run. Do not change the security policy in your computer. ...."

1.I have ran caspol.exe and granted full trust to the assembly on the
end user's machine.

2. When i look at the details of error, it shows the dll is loaded from
correct network folder.

3. I have also verified in Framework 2.0 configuration it shows my dll
under Local Intranet_Zone.

4. The solution works correctly on my development machine.

I am using Visual Studio 2005,VTSO 2005 and Framework 2.0

Thanks in advance for helping me with this.




Visual Studio Tools for Office14  
 
 
OmegaMan





PostPosted: Visual Studio Tools for Office, Cannot access assembly from end user computer Top

Did you create a program to write to the spreadsheet's manifest, letting it know that it will be using remote assemblies Example code can be found here in this post.

 
 
NCAnand





PostPosted: Visual Studio Tools for Office, Cannot access assembly from end user computer Top

Hi OmegaMan,

Thanks for you suggestion. I have tried everything as per this link

http://blogs.msdn.com/vsto2/archive/2005/10/13/480648.aspx

The error i get is

he customization does not have the required permissions to execute.


************** Exception Text **************
System.Security.SecurityException: The customization does not have the required permissions to execute.
at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.HandleOnlineOffline(Exception e, String basePath, String filePath)
at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.LoadStartupAssembly(EntryPoint entryPoint, Dependency dependency, Dictionary`2 assembliesHash)
at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.ConfigureAppDomain()
at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.LoadAssembliesAndConfigureAppDomain(IHostServiceProvider serviceProvider)
at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.ExecuteCustomization(IHostServiceProvider serviceProvider)
The Zone of the assembly that failed was:
MyComputer


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Applications.Runtime
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.42
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Runtime/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Runtime.dll
----------------------------------------
Microsoft.Office.Tools.Common
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.42
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.Office.Tools.Common/8.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Common.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
ExcelWorkbook3
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///U:/TestDeployAssembly/ExcelWorkbook3.DLL
----------------------------------------

As you can see my assembly is found and the issue it is getting into is while running it.

Please let me know if you have any other suggestions.

Regards,

Anand Chida



 
 
OmegaMan





PostPosted: Visual Studio Tools for Office, Cannot access assembly from end user computer Top

This could be due to a few issues, check out these items:
  1. The target assembly on the network server has not been registered with Caspol properly caspol -m -q -ag LocalIntranet_Zone -url "<full assembly path>" FullTrust -n "<name>"
  2. One has support dlls which reside in the network directory but have not been registered by Caspol for trust. The best way to get around that is to register the network directory with caspol and not individual assemblies. (\\server\director\*) Otherwise all, support and the main, assembly needs to be registered in Caspol individually.
  3. The manifest of excel file has not been altered to inform it to trust the primary target assembly.
Good luck.


 
 
NCAnand





PostPosted: Visual Studio Tools for Office, Cannot access assembly from end user computer Top

Hi Omegaman,

caspol -m -q -ag LocalIntranet_Zone -url "<full assembly path>" FullTrust -n "<name>"

is run on the target server(The server where the assembly resides, the network server).

Still i get this error.

If you look the documentation they suggest to run caspol tool only on the client machine. As the excel which runs on client machine has link to the assembly on the server. As the client machine needs to execute the assembly hence we should run caspol on client machine. This was my understanding.

To verify if i have all the tools, on the client machine if i install the assembly on a different directory (on local machine) then it works. I have also used Microsoft PSS VSTO Client Troubleshooter and i don't find any issues with my client machine.

Still i am in dark about this issue, thanks for your time.

Regards,

Anand Chida



 
 
OmegaMan





PostPosted: Visual Studio Tools for Office, Cannot access assembly from end user computer Top

Sorry my first sentance does imply something:

The target assembly on the network server has not been registered with Caspol properly caspol -m -q -ag LocalIntranet_Zone -url "<full assembly path>" FullTrust -n "<name>"

it should have said

The target assembly, which resides on the network server, has not been registered with Caspol properly caspol -m -q -ag LocalIntranet_Zone -url "<full assembly path>" FullTrust -n "<name>" on the client machine for the target document.

 
 
Reza Chitsaz - MSFT





PostPosted: Visual Studio Tools for Office, Cannot access assembly from end user computer Top

Do you have .NET Fx 1.1 and 2.0 installed on this client machine

 
 
NCAnand





PostPosted: Visual Studio Tools for Office, Cannot access assembly from end user computer Top

Hi Reza,

Yes i have .Net Fx 1.1 and 2.0 installed on the client machine.

If i install the assembly on (different folder) on the client machine it works.

But once i move the assembly to the server it stops working.

I have tried 1. Mapping the Network drive 2. Using UNC name 3. Using HTTP for the location of the assembly.

Still it fails.

Let me know if you have any suggestions.

Regards,

Anand Chida



 
 
Reza Chitsaz - MSFT





PostPosted: Visual Studio Tools for Office, Cannot access assembly from end user computer Top

Hi Anand, try the Office 2003 update found in this KB article: http://support.microsoft.com/kb/907417

I'm stating the obvious here, but just incase :-), are you sure you're using the 2.0 caspol and updating 2.0 policy and not 1.1 policy by mistake



 
 
OmegaMan





PostPosted: Visual Studio Tools for Office, Cannot access assembly from end user computer Top

For each move, after you have moved the file did you

1) Updated the manifest to reflect that it should look on the server
2) Update via Caspol to have trust for the server location

You did not mention that, and not being there, we cannot assume. Thanks.


 
 
NCAnand





PostPosted: Visual Studio Tools for Office, Cannot access assembly from end user computer Top

Hi,

Yes i update the manifest each time and caspol updates the .net framework 2.0 configuration.

Thanks.

Regards,

Anand Chida



 
 
NCAnand





PostPosted: Visual Studio Tools for Office, Cannot access assembly from end user computer Top

Hi Reza,

I have already applied the update you mentioned.

I am using Caspol 2.0 and updating Framework 2.0 configuration.

Regards,

Anand Chida



 
 
OmegaMan





PostPosted: Visual Studio Tools for Office, Cannot access assembly from end user computer Top

The one last thing you can use is the .Net Framework (2.0) Configuration tool. If the .Net SDK was installed on the machine, this tool can be used to view the permissions. Find it on the system and run it. Look at the folder

.Netframework 2.0 Configuration\My Computer\Runtime Security Policy\Machine
\ Code Groups

In there look at All_Code\LocalIntranet_Zone and see if the pathing to your server as an URL is correctly specified. If you named the trust, it should be easy to find. Otherwise it maybe within the list. If the trust is not in the list as \\Server\directory\MyAssembly.dll or \\Server\Directory\* that could be the indication of the problem. Good luck.