Hello!
I developed a custom task pane with VSTO for a Word2003 report and now I would like to enable access for my clients to this document. I copied the document to a server folder in my intranet and tried opening it, but I got the following error::
"The customization assembly could not be found or could not be loaded"
"The customization does not have the required permissions to execute."
Therefore, I need to grant access to a server folder where the document and the assembly will be located. I checked http://msdn2.microsoft.com/library/k64zb6we(en-us,vs.80).aspx and followed the "How to: Grant Permissions to Folders and Assemblies" procedure step by step. However I still keep getting the same error!
I noticed this note "You must be an administrator to grant full trust to an assembly or folder on a network computer, and trust must be granted at the Machine level instead of the User level". Perhaps this is the problem! I've created a folder in the server and used my .NET Configuration Tool... I believe it should be done directly on the server...
Or perhaps I should use the "How to: Grant Permissions to Documents and Workbooks in Shared Locations" procedure
Can anyone help me
Thanks in advance!
Best regards,
Ricardo Pinto
Ps: here is the full error message
The 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.DomainFactory.CreateDomain(Uri evidenceUri, String domainName, String codeBase, String configFileName, IAddinSecurityManager secman)
at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.CreateCustomizationDomainInternal(Uri uriFullDocumentDirectory, Uri uriFullDocFilePath, String documentName, IHostServiceProvider hostCallback, IAddinSecurityManager secman, AppManifest& applicationManifest, Boolean& manifestDirty, IAppInfo& appInfo)
at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.CreateCustomizationDomain(String applicationDomainPath, String documentName, IHostServiceProvider hostCallback, IExecuteCustomization& executor)
at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManager.CreateCustomizationDomain(String applicationDomainPath, String documentName, IHostServiceProvider hostCallback, IExecuteCustomization& executor)
The Zone of the assembly that failed was:
MyComputer
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50215.44 (beta2.050215-4400)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50215/mscorlib.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Applications.Runtime
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50215.44
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Runtime/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Runtime.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50215.44 (beta2.050215-4400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
Microsoft.Office.Tools.Common
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50215.44
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.Office.Tools.Common/8.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Common.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50215.44 (beta2.050215-4400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

Deploying VSTO Word Project: could not find or load customization assembly
Annddrew
Hi.
I'm too am experiencing a few problems getting my VSTO Word customisation to run.
I'm running Visual Studio 2005 Professional.
I created a local web site http://localhost/AnotherTest
The web app consists of Default.aspx with a single button.
The code-behind the button is as follows:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim file As FileStream = New FileStream( _
"C:\Inetpub\wwwroot\AnotherTest\MyDoc.doc", _
FileMode.Open, FileAccess.Read)
Dim template As Byte()
Try
template = New Byte(file.Length) {}
file.Read(template, 0, CType(file.Length, Integer))
Finally
file.Close()
End Try
Dim sd As ServerDocument = New ServerDocument( _
template, ".DOC")
Try
sd.CachedData.HostItems("MyDoc.ThisDocument"). _
CachedData("TestData").SerializeDataInstance( _
"Hello")
sd.Save()
Finally
sd.Close()
End Try
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/vnd.ms-word"
Response.OutputStream.Write(template, 0, template.Length)
Response.Flush()
Response.Close()
End Sub
I created a VSTO Word document project called MyDoc containing a line of text and a single bookmark.
The code-behind is as follows:
Public Class ThisDocument
<Cached()> Public TestData As String
Private Sub ThisDocument_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
Me.Bookmark1.Text = Me.TestData
End Sub
Private Sub ThisDocument_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown
End Sub
End Class
I published the document to http://localhost/AnotherTest
I ran caspol -ag 1.2 -url http://localhost/AnotherTest/* FullTrust
When running http://localhost/AnotherTest/MyDoc.doc from Start/Run
or
Clicking on the button in the web site and clicking Open I get the following message:
The 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.CreateCustomizationDomainInternal(Uri uriFullDocumentDirectory, Uri uriFullDocFilePath, String documentName, IHostServiceProvider hostCallback, IAddinSecurityManager secman, AppManifest& applicationManifest, Boolean& manifestDirty, IAppInfo& appInfo)
at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.CreateCustomizationDomain(String applicationDomainPath, String documentName, IHostServiceProvider hostCallback, IExecuteCustomization& executor)
at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManager.CreateCustomizationDomain(String applicationDomainPath, String documentName, IHostServiceProvider hostCallback, IExecuteCustomization& executor)
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
----------------------------------------
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
----------------------------------------
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.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
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
msosec
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.3191.0
CodeBase: file:///C:/WINDOWS/assembly/GAC/msosec/7.0.5000.0__b03f5f7f11d50a3a/msosec.dll
----------------------------------------
I have tried every combination of setting FullTrust at Enterprise, Machine and User level to no avail.
Here is the most recent output from running caspol -lg
Microsoft (R) .NET Framework CasPol 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
Security is ON
Execution checking is ON
Policy change prompt is ON
Level = Machine
Code Groups:
1. All code: Nothing
1.1. Zone - MyComputer: FullTrust
1.1.1. StrongName - : FullTrust (I have removed strong name numbers)
1.1.2. StrongName - : FullTrust (I have removed strong name numbers)
1.2. Zone - Intranet: LocalIntranet
1.2.1. All code: Same site Web
1.2.2. All code: Same directory FileIO - 'Read, PathDiscovery'
1.2.3. Url - http://localhost/AnotherTest/*: FullTrust
1.3. Zone - Internet: Internet
1.3.1. All code: Same site Web
1.4. Zone - Untrusted: Nothing
1.5. Zone - Trusted: Internet
1.5.1. All code: Same site Web
1.6. Url - http://localhost/AnotherTest/MyDoc_1.0.0.2/*: FullTrust
Success
Can anyone help me
Many Thanks,
Brendan
The Beast
Even I have tried multiple ways to get the customization trusted and working but it did not work.
Only method it worked with the following steps :
1. Add the msosec.dll in Assembly cache
2. Add a new code group with full trust to MSOSEC.xml
Now Word should ready be for taking customization.
Assuming PIA are also installed in this Office installed (.net programability support)
3. This is part where alternative did not work till now.
Place the .dll of the Word project into GAC after signing it with strong name.
This solution worked for deployment to the web server with a URL similar to this.
http://son10325/WordDocument4/WordDocument4.doc (for local & intranet machine access)
and
http://localhost/WordDocument4/WordDocument4.doc (for local machine access)
This was accessible from the local machine as well as another machine in the intranet through the same URL.
Please tell if anybody has an alternative to avoid placing in GAC but with rest of the scenario remaining same.
Thanks,
Reny Mathew Abraham
renynet@hotmail.com
kspreston
hi akois,
I'm sorry, but I never did get this stuff to work correctly. For the moment I can manage without it, so I stopped trying to figure it out - but I will have to get back to it.
Arthlan
Umesh Kalia
hi guys,
i got the solution
Please check the following points:
1. Install the .Net FrameWork 2.0 and Visual Studio Tools for Office runtime on the client computer.
2. Edit the security policy of .Net FrameWork 2.0 configuration with the following steps at client computer:
1) Go to Control Panel > Administrative Tools > .Net Framework 2.0 Configuration
2) Go to My Computer > Runtime Security Policy > Machine > Code Groups > All_Code and add a new code group
3) Give a Code group name, say next and select the condition type as URL and give the URL where you put ExcelWork1.dll
For example, if you put the dll in \\server\ExcelWorkbook1\bin\Debug\ExcelWork1.dll
Please type \\server\ExcelWorkbook1\bin\Debug\* (access directly to server) . or Http://ExcelWorkbook1/bin/Debug/* (access from web)
4) Do next and assign Full Trust and say finish.
thats all..i hope its help..
Hari M
That step is no longer needed, and it has been removed from the documentation going forward. You can follow the procedure and just skip over the part about adding msosec.dll to the fully trusted list.
Harry Miller
Technical Editor
http://blogs.msdn.com/harrymiller
This posting is provided "AS IS" with no warranties, and confers no rights.
Mattrix
radioman
Thank you very much -- When I get back to it, I will try skipping that step. Can't wait to get caught on a future step!
Art
Rober
hi arthlan,
i am having problem as Ricardo, but in excel..can u give me step by step how to resolve that problem..
FYI: my deployment model is document location and Assembly location at Web server
thanks..
dcrocker
I saw this old post and I am getting the same error. I'm new to VSTO and am trying to get this to work. Using VS2005/VSTO, I created a Word doc that reads and displays data from an XML file. I want this to work on the client's web server so they can get a Word report based on data generated in the XML file.
I'm using VS2005 and when I run/debug the solution on my PC it works fine. I published the solution to the web server. When I try to browse the .doc in IE from the web server I get the error:
-------------------------------------------------------
The 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.CreateCustomizationDomainInternal(Uri uriFullDocumentDirectory, Uri uriFullDocFilePath, String documentName, IHostServiceProvider hostCallback, IAddinSecurityManager secman, AppManifest& applicationManifest, Boolean& manifestDirty, IAppInfo& appInfo)
at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.CreateCustomizationDomain(String applicationDomainPath, String documentName, IHostServiceProvider hostCallback, IExecuteCustomization& executor)
at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManager.CreateCustomizationDomain(String applicationDomainPath, String documentName, IHostServiceProvider hostCallback, IExecuteCustomization& executor)
The Zone of the assembly that failed was:
MyComputer
...............
----------------------------------------------------------------------------------
I followed the instructions on the following pages to give the assembly and document full trust (I used the .NET 2.0 Configuration tool):
http://msdn2.microsoft.com/en-us/library/zdc263t0.aspx
http://msdn2.microsoft.com/en-us/library/9w6bd8f1.aspx
I'm very unsure about how the server and client need to be configured. One obvious question, does Office need to be installed on the server Also, should I need to do any additional configuration on the settings on my computer (the client for this test). I already have the 2.0 framework and VS2005 (obviously), so I'm assuming that should be all I need. I'm not sure where to go from here.
Thanks for any help or insight.
Albino
Hi Ken,
I am having the same problem as Ricardo, except in Excel. I tried to follow the steps in the link 9w6bd8f1. When I got to step 2, to add msosec.dll to the fully trusted assembly list, I got an error about a key and a secure name -- sorry it was at work, I'm home now and don't remember the exact error. Should I have expected that
Thanks for any help you can provide.
Art
10kap
No, you can ignore that message and just keep going. Msosec.dll does not need a strong name, and your solution should work fine. You do not need to add msosec.dll to the trusted assemblies list.
Harry Miller
Technical Editor
http://blogs.msdn.com/harrymiller
This posting is provided "AS IS" with no warranties, and confers no rights.
Bagilu
Hi Ricardo,
If the users are going to be opening the Word document from the shared folder on the server then you also need to setup a .NET security policy to trust the location where the document resides.
I've included a link below to the help topic "How to: Grant Permissions to Documents and Workbooks in Shared Locations" which I think should resolve the security issue.
http://msdn2.microsoft.com/library/9w6bd8f1(en-us,vs.80).aspx
Regards,
Ken Laws
MSFT
This posting is provided "AS IS" with no warranties, and confers no rights.
For more information regarding Visual Studio Tools for Office 2005:
Best of Blogs: Visual Studio 2005 Tools for Office
http://msdn.microsoft.com/library/default.asp url=/library/en-us/odc_2003_ta/html/odc_landvsto2005_ta.asp
Visual Studio Tools for Office Forum
http://forums.microsoft.com/msdn/ShowForum.aspx ForumID=16
Visual Studio Tools for the Microsoft Office System
http://msdn.microsoft.com/office/understanding/vsto/default.aspx
tyoas
hi everyone,
i tried that but it did not work. Anything new
Tom Sharpless
Hi Harry:
I have the same errors and I tried to follow the steps, but I got the message said Msosec should have a strong name. Checked with Policy Assemblies and could not see Msosec already there. Should I use tool to make Msosec a strong name
Thanks!