I'm currently working on a function for my website that should work like this:
User upload an dll
I load the dll inside another app domain (with Assembly.LoadFrom) to inspect it with reflection
Unload the app domain and delete the .dll file
This works perfectly fine when I do it locally but when I upload it to my server I get:
Failed to generate files: Could not load file or assembly '/the/path' or one
of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
So the "Operation is not supported" make me a bit curious. Is it some kind of permission that I need to set the server? Or is it something I can fix through my config? Or is it simply that my server actually don't support it at all?
The only information I can see on my Windows/IIS server is that it use .NET version 4.
Set project Property Local copy = true ,if you are loading using reflection then provide deployment Item at Class level it will work.
Related
I am using XSockets for having two way (web socket based) communication between an XSockets Server and an existing C# desktop client application.
I have integrated code in my existing client application for communicating with XSockets Server.
For now, XSocket Server starts as a separate console application. It starts fine with no problems.
Then I am using following pseudo code block in my C# client application:
XSocketClient client = new XSocketClient("ws://127.0.0.1:4509/MyController", "*", false); //Error occurs right on execution of this line
client.Open();
Following is the Exception snapshot that throws out;
Exception of type 'XSockets.Plugin.Framework.Exceptions.ExportException' was thrown
Custom Message: Failed to load exported interfaces in assembly Microsoft.Practices.EnterpriseLibrary.Validation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Source: XSockets.Plugin.Framework
Stack Trace: at XSockets.Plugin.Framework.Composable.SatifyImportsExports()
at XSockets.Plugin.Framework.Composable.Initialize()
at XSockets.Plugin.Framework.Composable.GetExport[T]()
Type: System.IO.FileNotFoundException
Note: If I create a new C# windows form client project and try executing this code, it executes fine and connection is successfully made to the XSocket Server.
Means there is something disturbing from inside my existing client project.
What could the possible reason for this weird exception ? Any ideas? Thanks
Edit: I have noted that if I manually remove Microsoft.Practices.EnterpriseLibrary.Validation DLL from my Bin folder, it raises same kind of exception but with a different custom message this time. I mean then the error is related to some other DLL (of my existing application) present in Bin folder.
I ran into a similar problem yesterday and solved it like so:
Composable.ClearPluginFilters();
Composable.AddPluginFilter("XSockets.*.dll");
This code was called just before I bootstrapped my application and started my server. I know the question is kinda old but if anyone else end up here aswell.
Source from Google Groups
Ok found answer to my own raised question.
There can be two things related to this issue:
Microsoft.Practices.EnterpriseLibrary.Validation.dll was causing problem from the Bin => Release/Debug folders. From Visual studio project references list, right clicked the Microsoft.Practices.EnterpriseLibrary.Validation reference, clicked on Properties and set [Copy Local] property to false. XSocketsClient was now connecting successfully to the XSockets Server but some other logic of my existing application was still needing Enterprise Library which being Copy Local ==> false, was not coming available to the .Net Runtime, so it showed an Exception whenever Runtime was coming across those parts of code.
To resolve the later issue encountered because of removal of Enterprise Library reference, I added again Microsoft.Practices.EnterpriseLibrary.Validation reference and also added one another DLL Microsoft.Practices.EnterpriseLibrary.Common.dll and added its reference to my client application.
Now my client application connects fine to XSocket Server and also now no issue comes with the inclusion of Enterprise Library reference.
Seems like there are some things essential needed by Enterprise Library at runtime which lie in that second DLL.
Ok so I am trying to use the Palo DotNet SDK to access the OLAP server.
First I created an empty c# project, added the reference to Jedox.Palo.Dll.
It seems Jedox.Palo.Dll uses two other dll's namely 1. libpalo_en.dll 2. libpalo2.dll
(which are not type libraries themselves so can't be added as a references. See error below for more details on that).
So I read somewhere on SO that I need to add them to the Debug/bin directory of my application, and on doing so still got the error in the title. Then I changed the target framework from 4.0 to 2.0 and viola it worked!
So I then set out to do the same for a ASP.Net Website
I added the reference for the Jedox.Palo.Comm.dll and added the two other files to the bin directory. Image here: http://img200.imageshack.us/img200/6835/paloerror.png
But then I get the error message again. I have done everything I did in the C# application - Add the dll's to the bin dir, change the target framework to 2.0.
Here is the detailed error:
Warning 1 C:\Users\Development\Documents\Visual Studio 2010\WebSites\TestPalo\Default.aspx: ASP.NET runtime error: Could not load file or assembly 'Jedox.Palo.Comm.DLL' or one of its dependencies. The specified module could not be found. C:\Users\Development\Documents\Visual Studio 2010\WebSites\TestPalo\Default.aspx 1 1 C:...\TestPalo\
Here is the error message (pop up) if I try to add libpalo_ng.dll or libpalo2.dll as a reference:
A reference to 'C:\Users\Development\Documents\Visual Studio 2010\WebSites\TestPalo\Bin\libpalo_ng.dll' could not be added. No type libraries were found in the component.
So how can I overcome this. And if you're suggesting Reflector, it doesn't even tell me that Jedox.Palo.Comm.dll uses the other two dll's. So I'm not certain of its efficacy.
And is there like a separate folder where those two dll's need to be put, since this is an asp.net webite, since I feel that if it worked as a C# Application, there is no reason not to work as a web app.
Also should I add any references to those other two dll's int the web.config file?
Thanks in advance!
Solved. Just added the two depended dll to the sysWOW64 folder. Nothing else worked!
When running .net site, enable 32 bit Application in the IIS app pool configuration. Palo requires 32 bit.
I have been implementing RSA security for a project I am working on.
I'm using the SecurID4Net files found on the web to get this rolling, which by default are targeted to the .Net 2.0 framework, ANY CPU.
I created a derived SqlMembershipProvider which references the SecurID4Net.Interfaces project, targeting .Net 4.0, any CPU.
My class lib "Services" references the SqlMembershipProvider, also targeting Any CPU.
My web app "Services.Web" references the "Services" lib, .Net 4.0, Any CPU.
I'm not using the client profile for any assembly targeting .Net 4. Every reference I have described here has Copy Local set to True.
I have my local IIS default web site set up to my output folder for the web project, so I can Ctrl-Shift-B and browse my IIS folder. When my client app signs in for the first time (possibly 2 or 3 times), it works fine, but after that sign ins fail. Additionally, when attaching to the IIS7 process (Services.Web), I would get the following error:
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.Assembly.GetTypes()
at Microsoft.Tools.SvcHost.ServiceHostHelper.LoadServiceAssembly(String svcAssemblyPath)
The DLL it is having problems loading is the SqlMembershipProvider I created.
So, I changed the SecurID4Net.Interfaces project to target .Net 4.0, and recompiled. It seems to work consistently now (still testing this part), but CTRL-ALT-P to attach to the IIS process still results in the WcfSvcHost error popping up before I can actually attach to the process... everything else seems to be working.
I'm running my VS as admin so I can attach to an IIS process;
All references described are set to Copy Local = true;
All assemblies are targeting .Net 4.0 Full Profile;
All assemblies are reachable, not blocked by the copy operation to the server where this is hosted;
To my knowledge no syntax issues with the web.config.
Anyone have any ideas why this error keeps popping up? Why would this error pop up when everything seems to be working?
I think I found the answer almost immediately. After inspecting each AssemblyInfo.cs file in the chain of projects, I found this in my SqlMembershipProvider assembly:
[assembly: AssemblyCulture("EN-us")]
I removed the value so it's an empty string.
I had a very similar issue in another project I worked on a few months ago where the web site had this filled in, and the web site worked on the very first load, but every load thereafter failed with a very cryptic error which, after drilling down, found that it could not load the assembly, giving a FileNotFoundException.
I don't know why this tiny, simple attribute would cause so many headaches...
EDIT: I'm 99% certain this was it. When I attach to my IIS process I no longer get a WcfSvcHost error.
I made a great WCF service in my dev environment, then when I pushed it up to production I got various errors saying "This collection already contains an address with scheme http..."
So, I created a Custom ServiceHostFactory class for my service.
Now when I upload it I get:
The CLR Type 'WCFServices.MultipleHostFactory' could not be loaded during
service compilation. Verify that this type is either defined in a source
file located in the application's \App_Code directory, contained in a
compiled assembly located in the application's \bin directory, or present in
an assembly installed in the Global Assembly Cache. Note that the type name
is case-sensitive and that the directories such as \App_Code and \bin must
be located in the application's root directory and cannot be nested in
subdirectories.
I checked the GAC and my assembly is indeed there.
Can anyone explain why this error is occuring?
Again, I am using .NET 3.5 on Sharepoint 2010
Is it "WCFServices.MultipleHostFactory" or "WCFServices.MultipleHostsFactory"? If its the first, thats why because that namespace does not match that you said in your question.
It turns out that I was able to remove one of the bindings from the application host configuration file. After talking with the administrator, I found that he had two bindings for port 80. One was IP:80:[DNS name] and the other was :80:
We agreed to get rid of the :80: binding and the WCF service was able to deploy to SP.
If anyone ever runs into that CLR loading issue, please post with a solution. I still don't have a good explanation for that problem.
I'm encountering something I did not expect. I have a C# client that accesses a SOAP/WCF service, and the SOAP/WCF service is (trying to) use the AWSSDK.dll to get/put/enumerate objects stored in Amazon S3. Odd thing is, for some reason, the client is getting a FaultException`1 was unhandled with the error text:
Could not load file or assembly 'AWSSDK, Version=1.3.19.0, Culture=neutral, PublicKeyToken=cd2d24cd2bace800' or one of its dependencies. The system cannot find the file specified.
Any idea why in the world the client would need to have the DLL loaded? The server hosting the service has it loaded.
In any case, I added the DLL to the client (I have no clue why I would need to, but just for sanity's sake), and lo and behold, even with the DLL added as a reference, I get the exact same error.
Fault exceptions are generated from the service side so that indicates to me that your service is having the problem with the AWSSDK.dll reference. Make sure that your service has the reference to the file and that when you rebuild the dll is in the bin folder of the service startup project.
To build navigate to menu Build -> Batch Build.. -> Select All -> Rebuild.
You should not have to copy the file manually as the build process should copy it to the proper location if you have it referenced.
Another thing would be to check that you are building under the correct configuration. If the dll is x64 and you are running x86 that might also produce the above error (not exactly sure though).