WCF The service '/myservice.svc' activated due to an exception during compilation - wcf

Our current deployment strategy is to deploy all assemblies with each application / service but control where *.exe and service implementaion assemblies are deployed. With that in mind, I have a specific service that when I deploy 2 unreferenced resource assemblies I get a compilation error. System.IO.FileNotFoundException: Could not load file or assembly '****.resources, Version=1.0.1262.0, Culture=fr, PublicKeyToken=null' or one of its dependencies
I do not have the sub folders for each language deployed in the bin folder e,g, "fr" etc.
Can somebody tell me why these "unreferenced" assemblies are causing compilation errors?

Most of the time this kind of error can be attributed to a View referencing a resource by a resource key. This would cause an ASP.NET compile time error.
You can check to see what the requesting DLL is by using fuslogvw.exe to figure out what the binding error is. If it's a DLL with an obscure name like ASP.jwnca.dll this is probably the case.
Why not just deploy these files?
Hope this helps.

Related

Could not load file or assembly 'AspNet.Loader, Version=1.0.0.0'

im using ASP.NET 5 MVC6, and i am getting this error whenever i try to run application:
An attempt was made to load an assembly from a network location which
would have caused the assembly to be sandboxed in previous versions of
the .NET Framework. This release of the .NET Framework does not enable
CAS policy by default, so this load may be dangerous. If this load is
not intended to sandbox the assembly, please enable the
loadFromRemoteSources switch. See
http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
and when i dive a little deeper in error i find this:
Could not load file or assembly 'AspNet.Loader, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies.
Operation is not supported.
I tryed googling it, but no luck, any ideas?
Thanks in advance!
I have had this issue when deploying to Azure as well. My only solution was to make sure the file and permissions on the folder wwwroot/bin are such that the server can see and access this directory.

Could not load file or assembly 'NetTopologySuite, Version=1.13.4693.18484

ok, here's the situation.
I have two projects:
ASP.NET MVC 4 (references class library)
Class Library (Added RavenDB and Net Topology Suite from NuGet)
When I try to run 'SpatialGenerate' in any index, I get the following error:
Could not load file or assembly 'NetTopologySuite, Version=1.13.4693.18484, Culture=neutral, PublicKeyToken=f580a05016ebada1' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I am using .net 4.5 of course and I'm doing this in VS 2012 on Windows 8. I have tried hosting this in IIS/IISexpress and the cassini server. I have checked that the file and it's related files are all present in the bin/debug directories and their versions are accurate. I also created a unit test that calls the queries via the index and I get the same error.
I have searched everywhere and I can't seem to find anything. Furthermore, once I was able to execute the index and everything worked, but I don't know why and can't make it happen again.
You need to use the RavenDB.Ebmedded package or add RavenDB.Database

NUnit unable to load dll with String Key Name

I have a project in which I have some C# classes which I am building using csc in my ant script. I have also have written some unit tests which I want to test with NUnit2.6, My test class and actual class refer to one DLL which is compiled with String Key Name (.snk), if I install thi DLL in my GAC (gacutil /i myDLL.dll) everything works fine. As soon as I uninstall this DLL from my gac I get following error for all the test during the build when I try to run my test using NUnit;
Test Error : fromJDynTest1
[exec] System.IO.FileNotFoundException : Could not load file or assembly 'myDLL, Version=5.1.0.0, Culture=neutral, PublicKeyToken=c0409b584f86b2d6' or one of its dependencies. The system cannot find the file specified.
[exec] at fromJDynTest1()
...
...
Does anyone know how to resolve this. Let me know if you need any other information.
Thanks
--
SJunejo
The code you are testing cannot see the assembly in question when you place it in the gac it can see the assembly. You need to ensure that the code you are testing has the assembly in the bin directory when compiled (perhaps copy local is set to false in your project on the assembly reference).
The reason I am sure it is not a dependency (which is mentioned in the message) is because the situation is resolved when the assembly is placed in the gac. This error is not likely caused because the assembly is strongly named.
Failing that the test code refers to the assembly and that test code either doesn't have a reference or has the same problem (not in its compiled directory).
Would help if you posted the actual test or structure of the project.
.net locates assemblies as follows:
Determines the correct assembly version by examining applicable configuration files, including the application configuration file, publisher policy file, and machine configuration file. If the configuration file is located on a remote machine, the runtime must locate and download the application configuration file first.
Checks whether the assembly name has been bound to before and, if so, uses the previously loaded assembly. If it failed before it will fail again now.
Checks the gac. If the assembly is found there, the runtime uses this assembly.
Probes for the assembly (if you open up a .csproj file in a text editor you will see hintpaths, which try and help .net find the assembly).

Can't load assembly at runtime

I'm working with a 3rd party assembly to implement something in our in-house software. I can make the refence and work with the library without a problem, but when I run the program to test it i'm getting this error
"Can't load file or assembly "assembly file" nor either of its dependencies. The system couldn't find the specified file" (i'm from Mexico, exception is in Spanish so i had to tanslate it, sorry for the poor translation)
I have given read and write permission to the file, the folder, and for all users and still wont load it.
I saw that the assembly has the PublicKeyToken=null, does that have any to do with that i cant load the assembly????
I already asked the people who developes this assembly, but i'm not getting any response and I really wanna get this project finished
If this is a web application, is the DLL in the bin folder? If it is a deskop application, is it in the same directory as the executable? If not, you may need to set the "Copy Local" attribute on the dll to true in Visual Studio.
Assembly Binding Log Viewer:
The Assembly Binding Log Viewer displays details for assembly binds. This information helps you diagnose why the .NET Framework cannot locate an assembly at run time.
Plus to what Chris said, you have to ensure that if the 3rd party dlls need any other dlls then they must be also in the bin directory, (you can check this by looking at the original directory of the 3rd party dlls and copy all dlls that come with it)

Unable to load type NHibernate.ByteCode.Castle.ProxyFactoryFactory

As I read and try every topic similar without success, I decided to post my own question. My solution has a console app and a class library for dataaccess. The Nhibernate configuration is inside the appconfig in the console app (which I'm currently using for debug, as I will after make a Web App and migrate all configuration to web.config).
The exception is well know:
NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException: Unable to load type NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle.dll' during configuration of proxy factory class. Possible causes are: - The NHibernate.Bytecode provider assembly was not deployed. - The typeName used to initialize the 'proxyfactory.factory_class' property of the session-factory section is not well formed. Solution: Confirm that your deployment folder contains one of the following assemblies: NHibernate.ByteCode.LinFu.dll NHibernate.ByteCode.Castle.dll ---> System.IO.FileNotFoundException: Could not load file or assembly 'NHibernate.ByteCode.Castle.dll' or one of its dependencies. The system cannot find the file specified.
The steps I took to try to solve it:
1) The dll in the deployment folder - I have the following dll in my bin:
Castle.Core.dll - v. 2.5.1
Iesi.Collections.dll - v.2.0.0.1002
log4net.dll - v. 1.2.10.0
NHibernate.ByteCode.Castle.dll - v.3.0.0.2001
NHibernate.dll - v.3.1.0.4000
2) The configuration contains
name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode
3) I set my MetaManager.Data project to deploy in a x86 CPU
4) All dll in my bin folder are referenced in the project.
I think this it it. I do not know were else to go :(
To find out which dlls are loaded or rejected by which component you can use the "Assembly Binding Log Viewer" (Fuslogvw.exe) that belongs to the dotnetsdk . If logging is enabled it can show you wich assemblies are loaded and which assembly caused it to load.
For details see http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.80).aspx
I think the version of the Iesi.Collections and NHibernate.ByteCode.Castle assemblies should be the same as for the NHibnernate assembly, i.e. 3.1.0.4000 (at least that's the version of the assemblies distributed with NH 3.1.0 GA).