Showing posts with label Windows. Show all posts
Showing posts with label Windows. Show all posts

Saturday, 9 April 2016

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

Hi,
 
Today we have deployed some of our .exe's and dlls on the server and when we ran the .exe we were getting the below exception.
 
"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"
 
I did check the .net versions and found all the things are absolutely fine. After sometime, came to know that the dll was blocked on the server.
 
To unblock the DLL or EXE,
 
Right click on DLL or EXE --> choose Properties --> click the Unblock button --> Apply and Ok.
 
The reason behind this blocking is normally operating system will blocks the DLL if it is copied from a network location because of security reasons.
 
Hope this helps.
 
--
Cheers,

Gopinath

Thursday, 20 August 2015

How to install Windows Service

Hi,
 
Here are the steps for installing windows service.
 
  • Run Command as Administrator
  • Open “InstallUtil.exe” in Command Prompt. “InstallUtil.exe” tool is available in “C:\Windows\Microsoft.NET\Framework64\v4.0.30319\”.
  • Execute the command Installutil “abc.exe”
 
To Uninstall
 Installutil /u “abc.exe”
 
Note :Prerequisite is .Net Framework 4.0 installed on the machine

Hope this helps.
 
--
Happy Coding,
Gopinath
  

Wednesday, 15 July 2015

Install a DLL to the GAC on Windows Server 2012 using only PowerShell (without Visual Studio)

Prior to Windows Server 2012 I had been used to install DLL files in the Windows Global Assembly Cache (GAC) by either opening the Windows/Assembly folder and simply dragging and dropping the file, or by using GacUtil.exe

In Windows Server 2012 unfortunately drag and drop feature is gone and with out installing visual studio, you won't get GacUtil.exe.

Here is the way to register DLL to GAC using PowerShell.

Add a DLL to the GAC
Run the SharePoint PowerShell console as Administrator.
Execute the following command.


Set-location "c:\Dll"
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacInstall("c:\Dll\Sample.dll")
iisreset

Remove a DLL from GAC
Run the SharePoint PowerShell console as Administrator.
Execute the following command.


Set-location "c:\Dll"
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacRemove("c:\Dll\Sample.dll")
iisreset

Hope this helps
--
Happy Coding
Gopinath