# Error publishing app with dotnet fullframework APM

**URL:** <https://discuss.elastic.co/t/error-publishing-app-with-dotnet-fullframework-apm/209303>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [November 25, 2019, 12:45pm UTC](https://discuss.elastic.co/t/error-publishing-app-with-dotnet-fullframework-apm/209303 "2019-11-25T12:45:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![viniciusvelasco](https://avatars.discourse-cdn.com/v4/letter/v/91b2a8/32.png) [@viniciusvelasco](https://discuss.elastic.co/u/viniciusvelasco)\
**Post date:** [November 25, 2019, 12:45pm UTC](https://discuss.elastic.co/t/error-publishing-app-with-dotnet-fullframework-apm/209303/1 "2019-11-25T12:45:39Z")

</div>

Hello, I have a fullframework webapi and when adding the packages Elastic.APM Elastic.APM.AspNetFullFramework and Elastic.APM.EntityFramework6 and deploying to IIS on Windows 2012 I get the error below. On the development machine the error does not occur. Can you help me?

**Server Error**

Method not found: 'System.Collections.ObjectModel.Collection`1\<System.Net.Http.DelegatingHandler\> System.Web.Http.HttpConfiguration.get\_MessageHandlers()'. body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } @media screen and (max-width: 639px) { pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; } } @media screen and (max-width: 479px) { pre { width: 280px; } }

# Server Error in '/test' Application.

## _Method not found: 'System.Collections.ObjectModel.Collection`1\<System.Net.Http.DelegatingHandler\> System.Web.Http.HttpConfiguration.get\_MessageHandlers()'._

**Description:** An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

**Exception Details:** System.MissingMethodException: Method not found: 'System.Collections.ObjectModel.Collection`1\<System.Net.Http.DelegatingHandler\> System.Web.Http.HttpConfiguration.get\_MessageHandlers()'.

**Source Error:**

` An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.`

**Stack Trace:**

`[MissingMethodException: Method not found: 'System.Collections.ObjectModel.Collection`1\<System.Net.Http.DelegatingHandler\> System.Web.Http.HttpConfiguration.get\_MessageHandlers()'.]  
Api.Startup.ConfigureWebApi(HttpConfiguration config) in C:\test\Startup.cs:94  
Api.Startup.Configuration(IAppBuilder app) in C:\test\Startup.cs:41

[TargetInvocationException: Exception has been thrown by the target of an invocation.]  
System.RuntimeMethodHandle.InvokeMethod(Object target, Object arguments, Signature sig, Boolean constructor) +0  
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object parameters, Object arguments) +128  
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture) +146  
Owin.Loader.\<\>c\_\_DisplayClass12.b\_\_b(IAppBuilder builder) +93  
Owin.Loader.\<\>c\_\_DisplayClass1.b\_\_0(IAppBuilder builder) +209  
Microsoft.Owin.Host.SystemWeb.OwinAppContext.Initialize(Action`1 startup) +843 Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build(Action`1 startup) +51  
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +101  
System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +137  
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +172  
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo handlers) +618  
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo handlers, IntPtr appContext, HttpContext context) +172  
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +402  
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +343

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]  
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +579  
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +112  
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +712`

**Version Information:** Microsoft .NET Framework Version:4.0.30319; [ASP.NET](http://ASP.NET) Version:4.6.1055.0

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [November 25, 2019, 1:06pm UTC](https://discuss.elastic.co/t/error-publishing-app-with-dotnet-fullframework-apm/209303/2 "2019-11-25T13:06:54Z")

</div>

Hi @viniciusvelasco,

My first guess is that on your Windows 2012 machine you have different dlls compared to your dev machine.

One suspect could be the `System.Net.Http` dll. Could you maybe try adding an assembly redirect for this dll as suggested here: [https://stackoverflow.com/a/40439614/1783306](https://stackoverflow.com/a/40439614/1783306)

Additionally, is this only happening when you add the agent, or do you have the same problem without the agent, too?

---

<div class="post-metadata">

**Author:** ![viniciusvelasco](https://avatars.discourse-cdn.com/v4/letter/v/91b2a8/32.png) [@viniciusvelasco](https://discuss.elastic.co/u/viniciusvelasco)\
**Post date:** [November 25, 2019, 1:28pm UTC](https://discuss.elastic.co/t/error-publishing-app-with-dotnet-fullframework-apm/209303/3 "2019-11-25T13:28:04Z")

</div>

Hi @GregKalapos

Only occurred when adding the agent, it happened, because now adding to System.Net.Http in the project packages and it worked. Thank you for helping me. 🙏 👍👍👍

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 16, 2019, 9:30am UTC](https://discuss.elastic.co/t/error-publishing-app-with-dotnet-fullframework-apm/209303/4 "2019-12-16T09:30:04Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
