Hello!
I have just started to work with the Infragistics.Documents.Word namespace.
I tried to create a simple document using the following code:
Dim doc as new Infragistics.Documents.Word.Document
doc.save(filename)
This code creates a file but it also generates an exception. The exception is of type
"The type initializer for MS.Utility.EventTrace threw an exception"
I have implemented code that creates some text inside the document but that isn't included when it is saved. So something is wrong.
I am creating these files on a server with special rules of accesscontrol.
I am pretty sure that this has something to do with the server settings and not the Infragistics tools, but with an
exception like that, I am totally lost.
Someone out there who understands the problem?
/Henrik
"Requested registry access is not allowed" shows up as inner exception. TypeInitialaztionException.
Gives better information...
Hello Henrik,
Thank you for posting in our forum.
What we found is that our Word engine use FileStream with FileMode parameter set as OpenOrCreate, while same parameter in Excel engine is set to Create. To test if this rise the exception you are receiving I have implement a small sample project. This project creates two text documents. First with FileMode set to OpenOrCreate and second with same parameter set to Create. Please run this sample and try to create this two files on your server. Please let me know if you receive the same exception.
Please note, in order to be able to investigate this issue in deeper details I will need a little bit more information
- Can you send me the entire exception stack?
- From your post I have understood that you were able to create the Word file on your server. You received the exception after the file was created. Is this correct?
Waiting for your feedback.
Thank you for your feedback
The Package.Open methods in the WindowsBase assembly are using tracing when opening stream. It seems like there is a trace listener that need certain permissions to run, and it does not have it, so this is causing the issue. Please check if you can remove the tracing from your web.config file. Please follow the next link to find how you can remove listeners https://msdn.microsoft.com/en-us/library/w11c2b46%28v=vs.110%29.aspx
Please let me know if this solves your issue.
Looking forward to your feedback.
Milko, any news in this topic?
I cannot say that I undestand what to do in the app.config file. Can you help?
If I create xlsx files using com interop, there is no problem. I am not sure why this is a problem when I use the grid export functionality.
Hi Henrik,
You do not need to change the app.config of your Windows Forms application. You need to change the web.config of the application which manages the service you are using to connect to the server.
Please check this application and let me know if this solves your issue.
Looking forward to your reply
But where do you mean the web.config file should be located in my project?
My Project consists of one windows application and two class libraries.
I am trying to create the files on a file server, using my windows application Project...
“When I am creating the file on the server, I am doing it using a dedicated service user”
If I understand you correctly you are consuming some services in your Windows Forms application in order to create a user on the server and to export the file. You need to check the web.config of the application which manages this service. There you may find the trace listeners. Please check this application, and not you Windows Forms application, and try to remove the tracing.
No, I am not using any service. And sorry for not succeeding with this explanation ;-)
We have s standard file server in our company network. In a folder on this server (which is specific for this application), I have assigned something that I calla service user fulls rights to this folder. This user has modify right to be exact. I myself only have read access.
So to be able to create a file in this folder when I am running this application, I must use this "service user", since I don't have right to do that by myself.
When I run the application on my computer, my user is the one that is executing it, so all operations that are done from this application is done by "me" as standard.
Is Everything clear now?