Binding Error in .NET Web API

407 Views Asked by At

I am trying to create an OData endpoint for a Table valued function in my sql server. I am sure with my code, however all said and done, for 6 hours I am getting the error :

Server Error in '/' Application.

An unexpected exception occurred while binding a dynamic operation

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: Microsoft.CSharp.RuntimeBinder.RuntimeBinderInternalCompilerException: An unexpected exception occurred while binding a dynamic operation

Source Error: 


Line 30:                         {
Line 31:                             dynamic classobj = Activator.CreateInstance(type);
Line 32:                             model = classobj.GetModel();
Line 33:                         }
Line 34: 

Source File: c:\Users\novak\Desktop\Latest\ODataService\App_Start\WebApiConfig.cs    Line: 32 

Stack Trace: 


[RuntimeBinderInternalCompilerException: An unexpected exception occurred while binding a dynamic operation]
   Microsoft.CSharp.RuntimeBinder.RuntimeBinder.Bind(DynamicMetaObjectBinder payload, IEnumerable`1 parameters, DynamicMetaObject[] args, DynamicMetaObject& deferredBinding) +227
   Microsoft.CSharp.RuntimeBinder.BinderHelper.Bind(DynamicMetaObjectBinder action, RuntimeBinder binder, IEnumerable`1 args, IEnumerable`1 arginfos, DynamicMetaObject onBindingError) +712
   Microsoft.CSharp.RuntimeBinder.CSharpConvertBinder.FallbackConvert(DynamicMetaObject target, DynamicMetaObject errorSuggestion) +94
   System.Dynamic.DynamicMetaObject.BindConvert(ConvertBinder binder) +27
   System.Dynamic.ConvertBinder.Bind(DynamicMetaObject target, DynamicMetaObject[] args) +58
   System.Dynamic.DynamicMetaObjectBinder.Bind(Object[] args, ReadOnlyCollection`1 parameters, LabelTarget returnLabel) +233
   System.Runtime.CompilerServices.CallSiteBinder.BindCore(CallSite`1 site, Object[] args) +127
   System.Dynamic.UpdateDelegates.UpdateAndExecute1(CallSite site, T0 arg0) +338
   ODataService.WebApiConfig.Register(HttpConfiguration config) in c:\Users\novak\Desktop\Latest\ODataService\App_Start\WebApiConfig.cs:32
   System.Web.Http.GlobalConfiguration.Configure(Action`1 configurationCallback) +124
   ODataService.WebApiApplication.Application_Start() in c:\Users\novak\Desktop\Latest\ODataService\Global.asax.cs:23

[HttpException (0x80004005): An unexpected exception occurred while binding a dynamic operation]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9918021
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): An unexpected exception occurred while binding a dynamic operation]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9931916
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34248

I am unable to figure this out.

0

There are 0 best solutions below