API error published in Azure

Asked

Viewed 52 times

0

I have an error in an ASP.Net API with Entity Framework and Mysql, on my machine the application runs smoothly access the database and shows the results, however when I publish in Azure the application generates an error: "Object Reference not set to an instance of an Object."

I have already found that the error occurs at the moment I try to access the bank return var teste2 = context.CategoriaUsuarios.ToList();.

An error has occurred. Object Reference not set to an instance of an Object. System.Nullreferenceexception at Mysql.Data.Mysqlclient.MySqlProviderServices.Getdbprovidermanifesttoken(Dbconnection Connection) at System.Data.Entity.Core.Common.DbProviderServices.Getprovidermanifesttoken(Dbconnection Connection) at System.Data.Entity.Utilities.Dbproviderservicesextensions.Getprovidermanifesttokenchecked(Dbproviderservices providerServices, Dbconnection Connection) at System.Data.Entity.Infrastructure.Defaultmanifesttokenresolver.<>c__DisplayClass1.b__0(Tuple3 k) at System.Collections.Concurrent.ConcurrentDictionary2.Getoradd(Tkey Key, Func2 valueFactory) at System.Data.Entity.Infrastructure.DefaultManifestTokenResolver.ResolveManifestToken(DbConnection connection) at System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest) at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) at System.Data.Entity.Internal.RetryLazy2.Getvalue(Tinput input) at System.Data.Entity.Internal.Lazyinternalcontext.Initializecontext() at System.Data.Entity.Internal.Internalcontext.Getentitysetandbasetypefortype(Type entityType) at System.Data.Entity.Internal.Linq.Internalset1.Initialize() at System.Data.Entity.Internal.Linq.InternalSet1.get_InternalContext() at System.Data.Entity.Infrastructure.Dbquery1.System.Linq.IQueryable.get_Provider() at System.Linq.Queryable.Where[TSource](IQueryable1 source, Expression1 predicate) at Eng3W.Sistema.Api.Controllers.ValuesController.Get() 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, IDictionary2 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.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.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.Dispatcher.Httpcontrollerdispatcher.d__1.Movenext()

  • Your app runs on your machine pointing to the Mysql database also in Azure?

  • Yes, this in an Azure Mysql database as well.

  • Using clearDB, or uploaded a VM and installed Mysql on it yourself?

  • I’m using the same clearDB!

  • I tried to do a test now on a Mysql database on a Locaweb server and again it works locally but publishing in Azure generates error.

  • Generates an error in the publication? Which error?

  • I found the problem, the error was time to publish by VS2015, there were two options related to connection to the database that were selected, I unchecked these two options and the error stopped occurring.

Show 2 more comments

1 answer

0

I found the mistake:

inserir a descrição da imagem aqui

When I unchecked these two options the build ran on Azure.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.