• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 453
  • Last Modified:

.Net Error

I currently trying to run a program that uses .NET, from my XP Pro PC, from my PC the program accesses a file locate on a file 2003R2 share server but the process fail and I get this message:

['M:\test\AOD\Document Actions\FileName.cs': 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.]

Now from the same PC I can copy the same files locally to the PC and it works, I check my permissions for that user on the server and that user has rights, any thoughts?

Thanks.
0
ahmad1467
Asked:
ahmad1467
  • 5
  • 3
1 Solution
 
David Johnson, CD, MVPOwnerCommented:
right click on the executable and select unprotect (if it shows this)
or in your Visual Studio 10 modify the devenv.config
and add <loadFromRemoteSources enabled=true />

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.config

Make sure you run your editor i.e. notepad as an administrator or your edit will be virtualized and not come into effect.

Now rebuild your program.
0
 
David Johnson, CD, MVPOwnerCommented:
<configuration>
   <runtime>
      <loadFromRemoteSources enabled="true"/>
   </runtime>
</configuration>
0
 
ahmad1467Author Commented:
I tried right clicking on the executable but I did not  get the option to  select unprotect, then on the workstation I went to look for Visual Studio 10 modify the devenv.config  but the only file I could find is { C:\Program Files\Microsoft Visual Studio\COMMON\IDE\IDE98\ASP.TLB
Also on the server that holds the file that the workatation is trying to access I tried to find the directory and all I could find is [C:\Program Files\Microsoft Visual Studio 8\Common7\IDE] but I don’t see the file [devenv.config] only .config file I see in this folder is [PEVerify.exe.config]
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
David Johnson, CD, MVPOwnerCommented:
Which version of visual studio do you have installed and on what platform? The executable has to be recompiled.

Don't worry about the 2k3 box as you probably only have VS runtimes installed on it.

and it should have been devenv.exe.config
devenv.exe.xml
0
 
ahmad1467Author Commented:
The program that I am trying to run is an application that has been installed on the PC ,
Visual Studio is not installed on the PC.The application runs locally on the PC but the data is on the Files share server, and this is when I get the error. Now if I copy the same data that is located on the server locally to the PC it works. There is a link in the error that tells me to add this code

<configuration>
   <runtime>
      <loadFromRemoteSources enabled="true"/>
   </runtime>
</configuration>
 But I’m not sure where.
0
 
David Johnson, CD, MVPOwnerCommented:
n your program directory look for a file  file called ProgramName.exe.Config – this is an xml document which sets out many configuration settings. Open this with any text editor (by the way, have you tried Notepad++ ?), and right before the final closing </configuration> tag, insert the following:
<runtime>
<loadFromRemoteSources enabled="true" />
</runtime>

Now once you restart that program, you should be able to load files from networked locations, and the management of your .NET programs is now that little bit easier.
0
 
ahmad1467Author Commented:
I went into the program directory and I found about five different .exe.Config.files .
The one that I found closes to the [ProgramName.exe.Config] looked like this

[<?xml version="1.0"?>
<configuration>
    <configSections>
        <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
            <section name="Program.Ur.Engine.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
        </sectionGroup>
    </configSections>
    <system.serviceModel>
        <bindings/>
        <client/>
    </system.serviceModel>
    <applicationSettings>
        <Program.Ur.Engine.Properties.Settings>
            <setting name="Provr_Engine_YoDesignpS50_Service" serializeAs="String">
                <value>http://localhost:80</value>
            </setting>
        </Program.Ur.Engine.Properties.Settings>
    </applicationSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>]

Does this look like it could be the one?
0
 
David Johnson, CD, MVPOwnerCommented:
what is the executable that you start the program with .. typically that is the .config you need to change. You may have to change them all. Easier for the programmer to just change visual studio and then recompile the program
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now