MainApp/bin
There are some custom dlls here:
MainApp/bin/Custom_Dlls
I've added a probing as below to the web.config file located under the MainApp:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="bin;bin\Custom_Dlls" />
</assemblyBinding>
</runtime>
When I run my .aspx web page whose dll is under Custom_Dlls folder, it shows me an error message that the "Could not load type ..." which means it can't find the dll.
System.Web.HttpParseException (0x80004005): Could not load type <AssemblyName>.WebForm1'.
I've also tried using the full physical path "file:///C:\MainApp\bin\Custom_Dlls" but doesn't work.
Any help? anything else I'd need to do?
Thanks,
You can sign your assembly and deploy it to GAC. This will do the job for you.
Alternative is to load assembly at runtime. Take a look at my post for loading plugins:
VB.NET dynamic plugin components
Related
I have a DLL that gets used in my code and when I hit the code that loads the DLL it throws an exception since the DLL is being loaded from the GAC.
The problem here is that the DLL has dependencies on other configuration files that need to be explicitly in the same folder but the exception that I got is:
Could not find file
'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary
ASP.NET
Files\root\13cabfea\3fbdd7f4\assembly\dl3\4770150e\00f03f08_2249d301\default.config'
That file doesn't appear in the directoty but it is available in bin folder along with the DLL that I am trying to load.
With that being said, I read some documentation where says it is possible to load the DLL from a different location adding some changes in the web.config. This is what I tried
<dependentAssembly>
<assemblyIdentity name="MyDll.dll" culture="neutral" publicKeyToken="6c02f43d970a9831" />
<codeBase version="6.0.0.0" href="file://c:\inetpub\MyWebApp\bin\SubFolder\MyDll.dll"/>
</dependentAssembly>
This approach didn't work since it is still throwing the exact same exception and I am running out of ideas... Is there a way I can use the DLL specified in the bin folder rather than the other location?
When trying to run my project/website I get the error message:
Could not load file or assembly 'System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
I don't know where the System.Web.Helpers is coming from it is not even referenced in my solution. I did a find all for System.Web.Helpers and on 3.0.0.0 and it found neither. Also this project is working for other people on my team on the same branch.
I've looked around the internet and tried a lot of the solutions. Running out of ideas.
For myself, I had to remove all <dependentAssembly> references to the DLLs being complained about from:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
Once removed this issue was fixed. I also ensured MVC 3 and MVC 4 were installed via the Web Platform Installer
I've deployed a MVC 4.5 web site here
However, when I view the site in browser after deployment, I have to turn custom errors off to see the following error:
Exception Details: System.IO.FileNotFoundException: Could not load file or assembly
'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or
one of its dependencies. The system cannot find the file specified.
I ensured that CopyLocal is set to True for the DLL in my References folder. What other changes need to be made for a successful deployment?
I was having this same issue today and I'm not completely sure what I did to fix it. So I'll try giving a detailed walk through of my process.
I tried deploying a default app out of VS13 and it was too bombing with this message. FAIL.
I then removed the Newtonsoft.Json assembly and manually added the 5.0.6 version I needed. I also made sure CopyToLocal was set to true. FAIL. My sadness grows.
I enabled NuGet Package Restore. FAIL. My sadness turns to anger.
I deleted my Azure site in a fit of rage, recreated it, and the republished out again. SUCCESS!!!
So, the only logical(ish) answer I think I can give is to delete your Azure website, recreate it, and then publish again.
I hope this helps someone.
I fixed this problem by redirecting the assembly version from 0.0.0.0-6.0.0.0 to 6.0.0.0
by adding a depententAssembly in Web.config:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- Add these 4 lines to Web.config, under runtime/assemblyBinding -->
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<!-- End of copy -->
</assemblyBinding>
</runtime>
<configuration>
You will find other dependentAssemblies there too, like System.Web.Mvc, WebGrease.
The newest version of Newtonsoft.Json is now 6.0.3. You may have to increase 6.0.0.0 later. Find the current newest version by looking at the version in the Solution Explorer. References -> Newton.Json -> (right click -> Properties) -> Version in the Property view
If you're sure CopyLocal is true, then the only other possibility is that you have project reference to a different assembly version than what's listed in your packages.config. Make sure the DLL version matches the version in the packages.config.
This exception is not showing when debugging locally and shows up only when i browse to the remote url address of the server..
I have FTP'd the MVC 3 app to my remote server and a check of the Bin folder there shows that I have all three MySQL reference assemblies. All are version 6.4.4.0.
In my web.config file all of the version numbers relating to those are set to version 6.4.4.0.
Why am I getting this error message about version 6.3.6.0, and how can this be solved?
Could not load file or assembly 'MySql.Data, Version=6.3.6.0,culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Exception Details: System.IO.FileLoadException: Could not load file or assembly 'MySql.Data, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
There are a lot of things to check with this, but the most common one I've run accross was resolved by making sure the assembly is referenced correctly in the Visual Studio project and that the information is correct in the web.config.
In Visual Studio, check the properties on the references for the assemblies
verify the the version listed.
check if Specific Version is true/false.
check if Copy Local is true.
If the version is wrong, you may have to remove and re-add the reference.
I would guess the exception was not thrown on your local machine because the older version of the assemblies are available on your machine.
The reason your local information is showing in the exception is unrelated to the assembly reference issue. Your local system is where the assembly was built, and so that information is built in for debugging purposes. (If this exception was thrown while you were debugging, VS would bring you to that line of that file.)
Ok I was worried that I somewhere along the way bits of 6.3.6.0 where left on my system from when I had it installed.. After days of trying to figure this one out I actually have come up with the fix for this issue... I just simply needed to overwrite the version information using assembly binding in the web.config. Once I did that it loads from the remote server error free... Here is what I added to my web.config:
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" />
<bindingRedirect oldVersion="0.0.0.0-6.3.6.0" newVersion="6.4.4.0" />
</dependentAssembly>
Could you please explain where I put the "Copy local = true" I do not see it as being part of any property window. I did find "Always Copy" for the resources. also where does this go in the web.config
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" />
<bindingRedirect oldVersion="0.0.0.0-6.3.6.0" newVersion="6.4.4.0" />
</dependentAssembly>
I ran the package manager console and then used this to fix this problem:
PM> Install-Package MySQL.Data.Entities
I have a simple question about adding references to a .NET project. I'm adding reCAPTCHA to a website and i have downloaded the dll.
After setting the reference to the dll i build and run the project and gets this error:
[ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.]
System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark) +0
System.Reflection.Assembly.GetTypes() +96
StarSuite.Core.Settings.GetSingletonInstancesOfBaseType(Type baseType, String staticMethodName, Type returnType) +149
[ApplicationException: Unable to load types from 'Recaptcha, Version=1.0.5.0, Culture=neutral, PublicKeyToken=9afc4d65b28c38c2'. LoaderExceptions: [FileNotFoundException: Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
]
What am i missing, why do i get this error?
Sorry if the question is silly...Is it your web project MVC? It seems that If you're using web form based project you shouldn't use that component since it relies on mvc assemblies (maybe there is a web form version?).
File Not Found:
This is you reason - its in the output:
FileNotFoundException
Double check where your reference is pointing to
Have you added the DLL under references in your project so it will be included in the build?
For people finding this whilst searching for a fix for Umbraco, the fix can be found here:
http://our.umbraco.org/forum/developers/xslt/19383-referencing-catcha-dll-breaks-xslt
The same fix can be applied to websites that are not running Umbraco.
Summary to save you having to read the whole forum post, add this to your web config:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0"
newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>