Solved

.Net Error

Posted on 2012-04-04
8
434 Views
Last Modified: 2012-04-24
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
Comment
Question by:ahmad1467
  • 5
  • 3
8 Comments
 
LVL 78

Expert Comment

by:David Johnson, CD, MVP
Comment Utility
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
 
LVL 78

Accepted Solution

by:
David Johnson, CD, MVP earned 500 total points
Comment Utility
<configuration>
   <runtime>
      <loadFromRemoteSources enabled="true"/>
   </runtime>
</configuration>
0
 

Author Comment

by:ahmad1467
Comment Utility
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
 
LVL 78

Expert Comment

by:David Johnson, CD, MVP
Comment Utility
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
Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

 

Author Comment

by:ahmad1467
Comment Utility
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
 
LVL 78

Expert Comment

by:David Johnson, CD, MVP
Comment Utility
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
 

Author Comment

by:ahmad1467
Comment Utility
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
 
LVL 78

Expert Comment

by:David Johnson, CD, MVP
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now