6
votes

I have created odata service and pack up into the Web installer. That package is working properly once I installed on my computer but I can't use it on other computers when I tried to run on different computers, it comes up with the following errors:

Any help would be really appreciated.

An error has occurred. An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = ConfigDataContext (ReflectionActivator), Services = [Deswik.MDM.Spatial.MDMPoints.DataContexts.Interface.IConfigDataContext], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> An exception was thrown while invoking the constructor 'Void .ctor(Deswik.MDM.SqlCommandBuilder.Interface.ISqlCommandBuilder, System.String)' on type 'ConfigDataContext'. ---> The ConnectionString property has not been initialized. (See inner exception for details.) (See inner exception for 'enter code here'details.) Autofac.Core.DependencyResolutionException at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable'1 parameters) at Autofac.Core.Resolving.InstanceLookup.Execute() at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable'1 parameters) at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable'1 parameters) at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable'1 parameters, Object& instance) at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable'1 parameters) at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context, IEnumerable'1 parameters) at Deswik.MDM.Spatial.MDMPoints.Controllers.MDMPointsController.Get(ODataQueryOptions'1 queryOptions) at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.b__9(Object instance, Object[] methodParameters) 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.ExceptionServices.ExceptionDispatchInfo.Throw() 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.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 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.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext() An error has occurred. An exception was thrown while invoking the constructor 'Void .ctor(Deswik.MDM.SqlCommandBuilder.Interface.ISqlCommandBuilder, System.String)' on type 'ConfigDataContext'. ---> The ConnectionString property has not been initialized. (See inner exception for details.) Autofac.Core.DependencyResolutionException at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable'1 parameters) at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable'1 parameters) An error has occurred. The ConnectionString property has not been initialized. System.InvalidOperationException at System.Data.SqlClient.SqlConnection.PermissionDemand() at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection) at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource'1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource'1 retry) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource'1 retry) at System.Data.SqlClient.SqlConnection.Open() at Deswik.MDM.Spatial.MDMPoints.DataContexts.ConfigDataContext..ctor(ISqlCommandBuilder sqlCommandBuilder, String connectionString) at lambda_method(Closure , Object[] ) at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()

1

1 Answers

4
votes

The exception tells you what is wrong:

The ConnectionString property has not been initialized.

When you're creating your connection you have to define the ConnectionString beforehand.