I'm trying to configure IIS to look for DLLs in the bin\Debug directory (as opposed to the bin directory). I tried updating my web.config, with the following line:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="bin\Debug" />
</assemblyBinding>
However, it still doesn't see that directory. Is there something else I am missing?
That's only for secondary assemblies. Jeff Atwood has blogged about it. You cannot entirely replace the bin folder. It just allows you to define an additional probing folder.
Related
Problem: I want to deploy modified code into web server. web server is having IIS version set to V2.0. and now I have developed and published code on my local machine with version 4.0. (there is App_code.dll as part of all dll files).
Now whenever I am deploying all files along with App_code.dll I am getting following error:"
Could not load file or assembly 'App_Code' or one of its dependencies.
This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded"
1) My question is how do I build App_code.dll in older version.
2) I tried changing target framework to V2.0 while publishing but then its not working because AJAX functions from other dll are not compiling..
can anyone please suggest what to do to run the site..
Help is appreciated.
Thanks
Sorry about the answers I've given... But try this...
Try adding <codeBase> elements to the application config file to specify the exact location of each dll, and the version of .Net it requires. Apparently this works because <codebase> is checked BEFORE the probing heuristics kick in each time an assembly needs to be loaded.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="sharedlibA" culture="neutral" publicKeyToken="..." />
<codeBase version="1.0.0.0" href="bin\sharedlibA.dll" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="sharedlibB" culture="neutral" publicKeyToken="..." />
<codeBase version="1.0.0.0" href="bin\sharedlibB.dll" />
</dependentAssembly>
</assemblyBinding>
</runtime>
If that doesn't work try this.
Late answer but, I'm writing this for future viewers.
I had same error after publish the application to the Server.
I figure it out doing like this.
While publish there is configuration in Setting.
In publish section there is option called
Precompile during publishing
you have to check the checkbox and save then Publish. This will takes your code files .vb/.cs and converts them into a compiled DLL files.
In my case it was unchecked.
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.
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
Is it possible within the web.config to set the local file path location of specific DLLs to load rather than having those DLL in the GAC or C:\Windows\System32.
This would make it much easier to deploy the web service, without having to mess around with either of those.
I have tried already to add the DLLs to the project but with out success. They are the 4 oracle instant client DLLs.
oci.dll
orannzsbb11.dll
oraocci11.dll
oraociicus11.dll
If anyone knows of a way of doing this that would be great.
EDIT:
Please note, note of the DLLs are "strongly named" so I cannot reference them using their public key.
Also, they are not referenced directly in the project currently because they fail to add.
You can use the dependentAssembly element to specify where a dll lives through the codeBase element.
However, I believe this needs to be a valid URL.
Example from MSDN:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="myAssembly"
publicKeyToken="32ab4ba45e0a69a1"
culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0"
newVersion="2.0.0.0"/>
<codeBase version="2.0.0.0"
href="http://www.litwareinc.com/myAssembly.dll"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Probing paths let you specify where an application should look for assemblies. This won't affect putting things in the GAC, but gives you an alternative to storing everything in the bin folder.
http://msdn.microsoft.com/en-us/library/823z9h8w.aspx
In my application(ASP.Net2.0),need to group the dlls. So that I used probing ande modified the web.config as follows
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="bin;../../../Runtime/Satellite"/>
</assemblyBinding>
</runtime>
It is not working in Asp.net2.0. Please help me
Sorry, probing only works for subdirectories of your app, never in directories "above" you in the tree.
You need to group the DLLs under your app directory (or use the GAC).