Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Friday, June 17, 2016 4:37 AM
I'm trying to install a windows service thro "InstalUtil" and it's refusing to register it with the ReflectionTypeLoadException Error (.Net Framework v4.5.50709).
Same service is getting registered fine when I install System.Web.Http in GAC using gacutil.exe but one of my other application is getting registered successfully without installing in GAC.
Here's the full quote:
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
What I have tried:
- I have inserted my .dll in the same folder as my .exe (the debug). Copy Local is set to "True"
- I rebuilt the project
- I have tried copying/running the InstallUtil.exe into the same folder from the .Net Framework, no luck.
What steps am I missing here? Is there any way I can dig into the project and find out what is causing this?
All replies (3)
Wednesday, June 22, 2016 7:28 AM âś…Answered
Hi Sreeram R,
System.Web.Http assembly is part of Microsoft.AspNet.WebApi.Core package. This package contains the core runtime assemblies for ASP.NET Web API.
Best Regards,
Chris
Friday, June 17, 2016 9:56 AM
Hi Sreeram R,
Based on the error message, one of the assemblies in the solution cannot be loaded or there is some missing reference. In the Solution Explorer, click the References tab, check your references, remove old dll and update to the latest one.
Best Regards,
Chris
Tuesday, June 21, 2016 5:15 AM
Yes Chris, I verified all projects in my solution referring "System.Web.Http", ensured that reference is pointing to my local path ~"D:\..\Lib\WebApi\System.Web.Http.dll" & copy local = true but still InstallUtil install fails if dll is not installed in GAC.
I also tried, catching exception thro ReflectionTypeLoadException, I inserted Try Catch ReflectionTypeLoadException block in Service's Main() method & in ProjectInstaller.cs's constructor but No error is caught.
I've also called System.Diagnostics.Debugger.Launch() in Try() block but error message throw first by which I assume Error thrown by InstallUtil even before executing above code lines.
Between,
**I'm wondering why I've to explicitly install "System.Web.Http.dll" in my GAC ?! **(I've .Net Framework 4.5 installed in my machine.)
**Isn't "System.Web.Http.dll" part Microsoft's framework package? **
**Is it advisable to GAC install Microsoft's "System.Web.Http.dll" by me? **
Thanks & Regards,
Sreeram