Wednesday, September 30, 2015

Copy GAC Files from One Server

In order to copy GAC files (Assembly .dll files) from one server to another follow the following steps:

1. on the CMD run the command:

    regsvr32 /u C:\windows\Microsoft.Net\Framework\v2.0.50727/shfusion.dll

This command will Create the GAC files into Folders where you can view the dll file.

2. Open the folder C:\Windows\assembly\GAC_MSIL. this folder contains all the assembly files as folders with dll file inside it.

3. Copy the Folder you need into the remote server (New Server you want to transfer the assembly to).

4. Copy the dll file to C:\ drive; for example: Microsoft.Web.Media.SessionHelper.dll

4. Open the Visual Studio CMD and write down the following command:

     gacutil /i C:\Microsoft.Web.Media.SessionHelper.dll and press enter.

If you got the message: Assembly successfully added to the cache, then you have successfully transferred the gac file from one server to another.

Tuesday, September 29, 2015

Oracle Client 12 64bits error: Installation failed to access the temporary location

If you encounter this error while installing Oracle client 12 64bits on windows 7 or windows server 2008, 2012 then do the following:

1. Go to Network and sharing Center -> Advanced sharing settings -> Turn On File and Printer Sharing and Turn on sharing so anyone with network access can read and write files in the public folders
2. Ensure that C$ share is enabled, and Administrator has full privileges on it (This can be checked by Advanced Sharing option when share the C:\ drive.
3. Make sure that the cmd command net use \\computer name\c$ works successfully. please make sure this command works and be aware to the computer name not localhost or IP address. If the command didn't work then go to hosts file and add the computer name with 127.0.0.1 record to the hosts file.
4. I don't if this step is required but do it in case all the above steps failed: go to regedit and browse to: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
and add new DWORD value called (LocalAccountTokenFilterPolicy) with value = 1.
5. You could change the temp and tmp locations in the local Environment variables tab to other locations than C:\users\admin\app data.........
6. Don't stop the services Server and Workstation. Keep them running so that sharing operations work successfully.
7. If you find a service related to Oracle then stop it.

Wednesday, May 13, 2015

Solving Rotativa Unhandled Exception Error

Rotativa is a great tool used to convert your html views to PDF files in web projects, it works fine with ASP.Net webforms and MVC where razor views can be converted to readable pdf, more information about Rotativa in the link below:

Rotativa Official website

You can Also download Rotativa for ASP.Net Nuget package in this link.
Rotativa Nuget

While working on different servers I have an error with unhandled exception when using rotativa, the error was:

Exception Description:: System.Exception at Rotativa.WkhtmltopdfDriver.Convert(String wkhtmltopdfPath, String switches, String html) at Rotativa.WkhtmltopdfDriver.Convert(String wkhtmltopdfPath, String switches) at Rotativa.AsPdfResultBase.CallTheDriver(ControllerContext context) at Rotativa.AsPdfResultBase.BuildPdf(ControllerContext context) at Rotativa.AsPdfResultBase.ExecuteResult(ControllerContext context) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass1e.<>c__DisplayClass28.b__19() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass1e.b__1b(IAsyncResult asyncResult)

After investigating with the issue, I start thinking of running the Rotativa execution program from the Command Prompt, like this:

wkhtmltopdf.exe README.txt test.pdf

So I Got an error:



This error is a missing C++ redistributable Package for Visual studio 2013 file called (MSVCP120.dll).

To solve the issue:
1. Open the C++ redistributable Package for Visual studio 2013 downloadable link below:
download Visual C++ Redistributable Packages for Visual Studio 2013

2. Click Download and choose the file (vcredist_x86.exe) even if you are running X64 bit server version.

3. Install the file.

this will add the missing dll file mentioned above, and the problem is now solved.

Happy Codding.

Thursday, January 22, 2015

Custom Http Module runs only with Integrated Pipeline mode on IIS application pool

When you write custom HTTP module in your .Net Application to run custom code at the application start event, you have to set the Application pipeline to Integrated Mode so that the application can see your custom HTTP module in the IIS and run it.
The problem rises when you publish MVC web application on the IIS with pipeline mode Classic, then you will see the error:

Error: An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.


To solve this problem, and keep your custom Http Module working correctly, then you may edit the web.config file with the following attribute.


       
   
 <configuration>  
   <system.webServer>  
     <validation validateIntegratedModeConfiguration="false"/>  
   </system.webServer>  
 </configuration>