Solved

.Net Error

Posted on 2012-04-04
8
442 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 80

Expert Comment

by:David Johnson, CD, MVP
ID: 37810186
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 80

Accepted Solution

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

Author Comment

by:ahmad1467
ID: 37827551
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
Independent Software Vendors: 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!

 
LVL 80

Expert Comment

by:David Johnson, CD, MVP
ID: 37827650
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
 

Author Comment

by:ahmad1467
ID: 37828452
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 80

Expert Comment

by:David Johnson, CD, MVP
ID: 37829810
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
ID: 37832546
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 80

Expert Comment

by:David Johnson, CD, MVP
ID: 37834309
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

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

685 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