I am facing a big problem that is doesn't let me access my web application. Resuming all, I developed a web api with asp.net using the VS2013 with .NET framework 4.5.1 in a machine. I have published the application and I put in server that I need to use with Windows Server 2008 and IIS 7. When I try to use my application, any request that uses api link returns me Error 500 (Internal Server Error). Why?
I've already read many tutorials on Internet, I have tried all of them but it is still not working. I've already tried to remove something from my web.config and add another things, but everytime I change, another different error returns me like "The OWIN manager is not configured", something like that.
Below you can see the important parts from my web.config.
<appSettings>
        <add key="owin:AppStartup" value="MyNamespace.Startup" />
        <add key="owin:AutomaticAppStartup" value="true" />
    </appSettings>
    <system.web>
        <identity impersonate="false" />
        <compilation targetFramework="4.5.1" />
        <httpRuntime targetFramework="4.5.1" maxRequestLength="51200" executionTimeout="3600" />
        <customErrors mode="Off" />
    </system.web>
<modules runAllManagedModulesForAllRequests="true">
            <remove name="FormsAuthenticationModule" />
            <remove name="UrlRoutingModule-4.0" /> 
            <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" /> 
        </modules>
        <handlers>
            <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
            <remove name="OPTIONSVerbHandler" />
            <remove name="TRACEVerbHandler" />
            <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
        </handlers>
And the problem that I am facing now is:
<Error>
<Message>An error has occurred.</Message>
<ExceptionMessage>
Object reference not set to an instance of an object.
</ExceptionMessage>
<ExceptionType>System.NullReferenceException</ExceptionType>
<StackTrace>
at PS_VirtualCalendar.Services.Controllers.LinksController.GetLinks_All() at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.AuthenticationFilterResult.<ExecuteAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()
</StackTrace>
</Error>
UPDATE
This is the code where we suppose that we can find the problem. Remembering that this error is returning because I am publishing the app in another server.
[HttpGet]
            [AllowAnonymous]
            [ResponseType(typeof(IEnumerable<ent_Links>))]
            public IEnumerable<ent_Links> GetLinks_All()
            {
                List<ent_Links> list_Links;
                ent_Links oEnt_Links;
                try
                {
                    using (BL_Links _srv = new BL_Links())
                    {
                        oEnt_Links = new ent_Links();
                        list_Links = _srv.BL_Links_GetList(oEnt_Links);
                    }
                }
                catch (Exception e)
                {
                    throw e;
                }
                return list_Links;
            }
Do you guys can help me? Any suggestion about what can I do? I really need your help.
Thanks a lot in advance!
