0

I have an (.Net 4.5.1) application that is often run from network shares (i.e. \\server\someshare\application.exe).

Unfortunatly this does not always work unless I add the line <loadFromRemoteSources enabled="true"/> to the application's configuration file.

The msdn documentation says:

In the .NET Framework 4.5, assemblies on local network shares are run as full trust by default; you do not have to enable the element.

So the problem seems to be that the server is not considered to be on the "local network".

I have searched around for some time trying to find out how a server is classified as "local network" but could not find anything conclusive. Some sites say I should add the server to the "trusted sites" in the internet settings but that has not helped when I tried it (and it also seems strange to add it there since it normally requires a https:// prefix).

Another confusing thing in the msdn documentation is the following:

If enabled is not set to true, an exception is thrown under the following conditions:
[...]
* The assembly being loaded is not from the MyComputer zone.

So in short: What are the requirements for a server to be in the local netwwork? Is it something that is configured on the server, the client or the domain?

(Both server and client is in the same domain and the user is logged in with a domain account)

  • You might want to make it clear your question is how to configure the server to be considered part of the local network by the client. – Ramhound Apr 3 '15 at 14:25
  • Is there a reason why don't want to use the configuration file? Also, are you sure you're targeting .NET 4.51 and not 4? Also, does the client have .NET 4.5 installed? – heavyd Apr 3 '15 at 14:32
  • @heavyd, it is not my application and config file changes are lost on upgrades, it is a suit of apps so it is actually 6 config files to edit. Also, having a server that is not classified as local network seem like a serious configuration error – adrianm Apr 4 '15 at 10:08
  • @heavyd, The application will not run unless .Net 4.5 is installed. – adrianm Apr 4 '15 at 10:16
0

I think it all depends on the access method i.e. if the client is running your application via network share Local network e.g.

\\server\someshare\application.exe

then this is considered as a local network.

On the other hand if your application is being accessed via HTTP then it is being accessed over the web e.g. http://server/path/application.exe. All references in the documentation around zones including the "MyComputer" zone are referring to web access.

Note that if your application is copied to local network share from the internet then it is flagged by Windows as a web app, and hence you could be experiencing this case. Here is the direct quote from MSDN:

If an application has been copied from the web, it is flagged by Windows as being a web application, even if it resides on the local computer. You can change that designation by changing the file properties, or you can use the element to grant the assembly full trust

| improve this answer | |
  • Thank you for your answer.Since I use \\server\share and still need loadfromremotesources it must be something else..If the file itself was flagged as web application (which it isn't) It would not run locally on the server. – adrianm Apr 4 '15 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.