Simple Inject is throwing the following exception when attempting to register my DbContext.
The supplied connection string is not valid, because it contains insufficient mapping or metadata information.
Parameter name: connectionString
I'm new to DI and could be missing something fairly obvious. The connection string looks fine. It is the same one that gets used to create the DbContext normally. I was attempting the solution here
public static class SimpleInjectorInitializer
{
/// <summary>Initialize the container and register
// it as MVC3 Dependency Resolver.</summary>
public static void Initialize()
{
var container = new Container();
InitializeContainer(container);
container.RegisterMvcControllers(
Assembly.GetExecutingAssembly());
container.RegisterMvcAttributeFilterProvider();
container.Verify();
DependencyResolver.SetResolver(
new SimpleInjectorDependencyResolver(container));
}
private static void InitializeContainer(
Container container)
{
}
}
Update: I still haven't solved my issue, but it is very similar to this issue with Ninject
Stack Trace:
System.InvalidOperationException was unhandled by user code
Message=The configuration is invalid. Creating the instance for type _AccountController failed. Error occurred while trying to get an instance of type _AccountController. The type initializer for 'Web.Controllers._AccountController' threw an exception.
Source=SimpleInjector
StackTrace:
at SimpleInjector.Helpers.Verify(IInstanceProducer instanceProducer, Type serviceType)
at SimpleInjector.Container.ValidateRegistrations()
at SimpleInjector.Container.Verify()
at Web.App_Start.SimpleInjectorInitializer.Initialize() in C:\workspace\BrowsarServer\QARSite\Web\App_Start\SimpleInjectorInitializer.cs:line 24
InnerException: SimpleInjector.ActivationException
Message=Error occurred while trying to get an instance of type _AccountController. The type initializer for 'Web.Controllers._AccountController' threw an exception.
Source=SimpleInjector
StackTrace:
at SimpleInjector.InstanceProducers.InstanceProducer.ThrowErrorWhileTryingToGetInstanceOfType(Exception innerException)
at SimpleInjector.InstanceProducers.InstanceProducer.GetInstance()
at SimpleInjector.Helpers.Verify(IInstanceProducer instanceProducer, Type serviceType)
InnerException: System.TypeInitializationException
Message=The type initializer for 'Web.Controllers._AccountController' threw an exception.
Source=Web
TypeName=Web.Controllers._AccountController
StackTrace:
at Web.Controllers._AccountController..ctor()
at lambda_method(Closure )
at SimpleInjector.InstanceProducers.InstanceProducer.GetInstance()
InnerException: System.ArgumentException
Message=The supplied connection string is not valid, because it contains insufficient mapping or metadata information.
Parameter name: connectionString
Source=System.Data.Entity
ParamName=connectionString
StackTrace:
at System.Data.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor)
at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName)
at Web.Models.BrowsarEntities..ctor() in C:\workspace\BrowsarServer\QARSite\Web\Models\Browsar.Designer.cs:line 90
at Web.Controllers._AccountController..cctor() in C:\workspace\BrowsarServer\QARSite\Web\Controllers\_AccountController.cs:line 15
InnerException: System.InvalidOperationException
Message=Unable to determine application context. The ASP.NET application path could not be resolved.
Source=System.Data.Entity
StackTrace:
at System.Data.Metadata.Edm.AspProxy.GetBuildManagerReferencedAssemblies()
at System.Data.Metadata.Edm.DefaultAssemblyResolver.GetAllDiscoverableAssemblies()
at System.Data.Metadata.Edm.DefaultAssemblyResolver.GetWildcardAssemblies()
at System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.LoadResources(String assemblyName, String resourceName, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.CreateResourceLoader(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.Metadata.Edm.MetadataArtifactLoader.Create(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.Metadata.Edm.MetadataCache.SplitPaths(String paths)
at System.Data.Common.Utils.Memoizer`2.<>c__DisplayClass2.<Evaluate>b__0()
at System.Data.Common.Utils.Memoizer`2.Result.GetValue()
at System.Data.Common.Utils.Memoizer`2.Evaluate(TArg arg)
at System.Data.EntityClient.EntityConnection.GetMetadataWorkspace(Boolean initializeAllCollections)
at System.Data.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection()
at System.Data.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor)
InnerException: System.Reflection.TargetInvocationException
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
StackTrace:
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Data.Metadata.Edm.AspProxy.GetBuildManagerReferencedAssemblies()
InnerException: System.InvalidOperationException
Message=This method cannot be called during the application's pre-start initialization stage.
Source=System.Web
StackTrace:
at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
at System.Web.Compilation.BuildManager.GetReferencedAssemblies()
InnerException:
The root cause is burried deep down in the inner exceptions. When inspecting the stack trace, you will be able to find the cause of this. The reason is in the following two inner exceptions:
InvalidOperationException: Unable to determine application context.
The ASP.NET application path could not be resolved.
and:
InvalidOperationException: This method cannot be called during the
application's pre-start initialization stage.
In other words, this exception is caused by a timing problem. I'm not sure if you can change your connection string to solve this, but you can also move your initalization to a later moment in starting the application. You can do this as follows:
Remove the [assembly: WebActivator.PreApplicationStartMethod] (top line) of the SimpleInjectorInitializer.cs class.
Add a call to the SimpleInjectorInitializer.Initialize() method in the Application_Start() event of the global asax.
After doing this, initializing (and especially, verifying) of the object graph is done after the pre-init state, which seems to be too early for EF in an ASP.NET environment.
Another option is to remove the container.Verify(); call from the SimpleInjectorInitializer.Initialize method, since it is the early verification process that is killing you. However, please read this Verify the container’s configuration first, to see alternatives, before doing so.
Although you use a class DbContext it looks like it is derived from ObjectContext. In that case you should use an EntityConnectionStringBuilder to build the connection string.
You may be missing some of the metadata information in your connection string. For example entity framework has some special metadata in the connection string, see sample below:
<add name="MyEntities" connectionString="metadata=res://*/MyEntitiesStore.csdl|res://*/MyEntitiesStore.ssdl|res://*/MyEntitiesStore.msl;provider=System.Data.SqlClient;provider connection string="Data Source=<your server>;Initial Catalog=<your DB>;Integrated Security=False;User ID=<user>;Password=<pass>;MultipleActiveResultSets=True""
providerName="System.Data.EntityClient" />
Related
I need to maintain a jenkins groovy script (we are not sure however if it ever worked).The script for a pipeline build has multiple stages ('revision' and 'build' stages before 'unit tests' have succeeded), one of which is the following:
stage('Unit Tests')
{
stages
{
stage('Tests')
{
parallel
{
stage('TRKengineTest')
{
steps
{
bat '"C:\\Program Files (x86)\\NUnit.org\\nunit-console\\nunit3-console.exe" TRKengine\\TRKengine.Test\\bin\\Release\\netcoreapp3.1\\TRKengine.Test.dll --result=TRKengine.Test.xml;format=nunit2 --timeout=180000 --workers=1'
echo "Something to do?"
}
}
stage('TRKengineGUItest')
{
steps
{
//bat '"C:\\Program Files (x86)\\NUnit.org\\nunit-console\\nunit3-console.exe" TRKengine\\TRKengineGUI.Test\\bin\\Release\\netcoreapp3.1\\TRKengineGUI.Test.dll --result=TRKengineGUI.Test.xml;format=nunit2 --timeout=180000 -v --workers=1'
echo "Nothing to do"
}
}
}
}
stage('Testresults')
{
steps
{
nunit testResultsPattern: 'TRKengine.Test.xml, TRKengineGUI.Test.xml'
}
}
}
}
The bat command returns a -100 error. More precisely:
C:\Jenkins\workspace\TRKengine_trunk>"C:\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe" TRKengine\TRKengine.Test\bin\Release\netcoreapp3.1\TRKengine.Test.dll --result=TRKengine.Test.xml;format=nunit2 --timeout=180000 -v --workers=1
NUnit Console Runner 3.6.1
Copyright (C) 2017 Charlie Poole
Runtime Environment
OS Version: Microsoft Windows NT 10.0.14393.0
CLR Version: 4.0.30319.42000
Test Files
TRKengine\TRKengine.Test\bin\Release\netcoreapp3.1\TRKengine.Test.dll
Errors, Failures and Warnings
1) Error :
Exception has been thrown by the target of an invocation.
Server stack trace:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
at System.AppDomain.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at NUnit.Engine.Drivers.NUnit3FrameworkDriver.Load(String testAssemblyPath, IDictionary`2 settings)
at NUnit.Engine.Runners.DirectTestRunner.LoadPackage()
at NUnit.Engine.Runners.DirectTestRunner.EnsurePackageIsLoaded()
at NUnit.Engine.Runners.DirectTestRunner.RunTests(ITestEventListener listener, TestFilter filter)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at NUnit.Engine.ITestEngineRunner.Run(ITestEventListener listener, TestFilter filter)
at NUnit.Engine.Runners.ProcessRunner.RunTests(ITestEventListener listener, TestFilter filter)
Test Run Summary
Overall result: Failed
Test Count: 0, Passed: 0, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
Start time: 2020-07-15 11:32:42Z
End time: 2020-07-15 11:32:43Z
Duration: 0.556 seconds
Results (nunit2) saved as TRKengine.Test.xml
script returned exit code -100
I have tried a couple of things:
1)First of all, it seems like the path of nunit-console.exe is wrong but as I found out, it can be used in recent releases of nunit.
2)The path of the test.dll is correct, as I manually navigated there and ..netcoreapp3.1\TRKengine.Test.dll is indeed there.
3)I have spotted --result=TRKengine.Test.xml;format=nunit2 in other exampels across the internet.
4)I experimented with removing any combinations of the remaining parameters, workers/timeout -v etc, without success.
So the line where the error appears, seems to be correct, and my intuition is that probably the mistake has already happened somewhere else.
I am not sure what "invocation" means. I have also checked How do you run NUnit tests from Jenkins? that seems related and it feels like Winston33 's proposition is exactly like what is happening here.
Something that is a bit worrying is that my machine is 64 bits but the path is ..x86.
I also have access to code and all projects inside the solution build successfully
I am a total beginner in both jenkins and groovy, so if I had not disclosed any necessary information please notify me.
Any help would be greatly appreciated.
The error message: Exception has been thrown by the target of an invocation is a common message for C# based products
means that nunit tries to call the target test dll dynamically but it (dll) throws some exception that unfortunately you don't see.
check the nunit issue that is very close to yours https://github.com/nunit/nunit/issues/1509
there is suggestion to set following nunit parameters
--trace=Debug to see more information about error
--inprocess to run tests in a single process
there several log files should be created that could contain helpful information to understand why the error occurred.
I've added a WCF Data Service (v5.6) called test.svc to the root of my MVC app but I can't seem to get my routing figured out so that I can access it. Below are the results I get back in the browser when I go to http:/test.svc along with my route code and test.svc file.
route table entry (first route rule I add):
routes.IgnoreRoute("{resource}.svc/{*pathInfo}");
[System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)]
public class test : DataService<MyEntities>
{
// This method is called only once to initialize service-wide policies.
public static void InitializeService(DataServiceConfiguration config)
{
// TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
config.SetEntitySetAccessRule("*", EntitySetRights.All);
config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
config.UseVerboseErrors = true;
}
Error shown in browser:
The server encountered an error processing the request. The exception
message is 'Expression of type
'System.Data.Entity.Core.Objects.ObjectContext' cannot be used for
return type 'System.Data.Objects.ObjectContext''. See server logs for
more details. The exception stack trace is:
at System.Linq.Expressions.Expression.ValidateLambdaArgs(Type
delegateType, Expression& body, ReadOnlyCollection1 parameters) at
System.Linq.Expressions.Expression.Lambda[TDelegate](Expression body,
String name, Boolean tailCall, IEnumerable1 parameters) at
System.Linq.Expressions.Expression.Lambda[TDelegate](Expression body,
Boolean tailCall, IEnumerable1 parameters) at
System.Linq.Expressions.Expression.Lambda[TDelegate](Expression body,
ParameterExpression[] parameters) at
System.Data.Services.Providers.DbContextHelper.CreateDbContextAccessor(Type
type) at
System.Data.Services.Providers.DbContextHelper.GetDbContextAccessor(Type
type) at
System.Data.Services.Providers.DbContextHelper.IsDbContextType(Type
type) at
System.Data.Services.DataService1.CreateMetadataAndQueryProviders(IDataServiceMetadataProvider&
metadataProviderInstance, IDataServiceQueryProvider&
queryProviderInstance, Object& dataSourceInstance, Boolean&
isInternallyCreatedProvider) at
System.Data.Services.DataService1.CreateProvider() at
System.Data.Services.DataService1.EnsureProviderAndConfigForRequest()
at System.Data.Services.DataService1.HandleRequest() at
System.Data.Services.DataService1.ProcessRequestForMessage(Stream
messageBody) at SyncInvokeProcessRequestForMessage(Object , Object[] ,
Object[] ) at
System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object
instance, Object[] inputs, Object[]& outputs) at
System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&
rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean
isOperationContextSet)
Looks like WCF DS and EF 6 are incompatible and there's no timeframe for when, or if, they might fix things.
http://social.msdn.microsoft.com/Forums/en-US/4aa92957-22de-4445-aecd-2871982afe28/eta-on-entity-framework-version-6-provider?prof=required
We just deployed a new v6 site to a host that has several v4 sites running on it no problem. On the front end, it looks fine, but in the Umbraco admin the Content and Media trees appear empty.
In the browser debugger I can see that there is an error in the TreeDataService.ashx.
The error is below and I'm not exactly sure what the issue is. Is it permissions? Database user permissions?
----------
You must set the singleton 'Umbraco.Core.Persistence.SqlSyntax.SyntaxConfig' to use an sql syntax provider
Parameter name: SqlSyntaxProvider
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.ArgumentNullException: You must set the singleton 'Umbraco.Core.Persistence.SqlSyntax.SyntaxConfig' to use an sql syntax provider
Parameter name: SqlSyntaxProvider
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:
[ArgumentNullException: You must set the singleton 'Umbraco.Core.Persistence.SqlSyntax.SyntaxConfig' to use an sql syntax provider
Parameter name: SqlSyntaxProvider]
Umbraco.Core.Persistence.SqlSyntax.SyntaxConfig.get_SqlSyntaxProvider() +89
Umbraco.Core.Persistence.Mappers.BaseMapper.GetColumnName(Type dtoType, PropertyInfo dtoProperty) +57
Umbraco.Core.Persistence.Mappers.ContentMapper.Map(String propertyName) +67
Umbraco.Core.Persistence.Querying.ModelToSqlExpressionHelper`1.VisitMemberAccess(MemberExpression m) +112
Umbraco.Core.Persistence.Querying.ModelToSqlExpressionHelper`1.Visit(Expression exp) +101
Umbraco.Core.Persistence.Querying.ModelToSqlExpressionHelper`1.VisitBinary(BinaryExpression b) +258
Umbraco.Core.Persistence.Querying.ModelToSqlExpressionHelper`1.Visit(Expression exp) +159
Umbraco.Core.Persistence.Querying.ModelToSqlExpressionHelper`1.VisitLambda(LambdaExpression lambda) +120
Umbraco.Core.Persistence.Querying.ModelToSqlExpressionHelper`1.Visit(Expression exp) +72
Umbraco.Core.Persistence.Querying.Query`1.Where(Expression`1 predicate) +20
Umbraco.Core.Services.ContentService.GetChildren(Int32 id) +312
umbraco.cms.businesslogic.web.Document.GetChildrenForTree(Int32 NodeId) +39
umbraco.cms.presentation.Trees.BaseContentTree.Render(XmlTree& Tree) +27
umbraco.loadContent.Render(XmlTree& tree) +19
umbraco.presentation.webservices.TreeDataService.LoadTree(TreeRequestParams treeParams) +79
umbraco.presentation.webservices.TreeDataService.GetXmlTree() +140
umbraco.presentation.webservices.TreeDataService.ProcessRequest(HttpContext context) +55
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
check you umbraco db connection string.
<add name="umbracoDbDSN".......
if it do contains
providerName="System.Data.SqlClient"
then Add it and check. the same. it might start working.
Problem is that SqlSyntaxProvider is null, my workaround is init it.
var service = new Umbraco.Core.Services.ContentService();
SqlSyntaxContext.SqlSyntaxProvider = new MySqlSyntaxProvider();
The connection string, add name="umbracoDbDSN" ... was missing the following providerName="System.Data.SqlClient"
Once I added that to the line things started working.
In our backing database, we have a Data field that is of type varbinary(max). Using Breeze we are able to save data in this field, however, when we want to call it back down we are getting errors. In our generated models, the field gets mapped to a byte[]. But when Breeze tries to serialize that into a string it throws up errors.
$id: "1",
$type: "System.Web.Http.HttpError, System.Web.Http",
Message: "An error has occurred.",
ExceptionMessage: "The specified cast from a materialized 'System.String' type to the 'System.Byte[]' type is not valid.",
ExceptionType: "System.InvalidOperationException",
StackTrace: " at System.Data.Common.Internal.Materialization.Shaper.ErrorHandlingValueReader`1.GetValue(DbDataReader reader, Int32 ordinal) at System.Data.Common.Internal.Materialization.Shaper.GetColumnValueWithErrorHandling[TColumn](Int32 ordinal) at lambda_method(Closure , Shaper ) at System.Data.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper) at System.Data.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at Breeze.WebApi.ODataActionFilter.OnActionExecuted(HttpActionExecutedContext actionExecutedContext) at System.Web.Http.Filters.ActionFilterAttribute.CallOnActionExecuted(HttpActionContext actionContext, HttpResponseMessage response, Exception exception) at System.Web.Http.Filters.ActionFilterAttribute.<>c__DisplayClass2.<System.Web.Http.Filters.IActionFilter.ExecuteActionFilterAsync>b__0(HttpResponseMessage response) at System.Threading.Tasks.TaskHelpersExtensions.<>c__DisplayClass41`2.<Then>b__40(Task`1 t) at System.Threading.Tasks.TaskHelpersExtensions.ThenImpl[TTask,TOuterResult](TTask task, Func`2 continuation, CancellationToken cancellationToken, Boolean runSynchronously)"
Any help would be great!
I have been unable to reproduce this.
Breeze is able to take a server side byte[] and convert it to a string on the client. You can see an example of this in the breeze 'DocCode' samples whenever an Employee entity is returned. The Employee type has a Photo property that has a server side datatype of 'byte[]' which is returned to the breeze client as a 'string'.
What I think you are running into is a server side materialization issue where you are trying to materialize a binary blob on the database into a string property. This would occur if your model property was typed as a 'String' instead of as a 'byte[]'.
Hope this helps.
My ASP.NET MVC 3 app works fine on my local machine (And usually works fine when i deploy it), but on this occasion i get the following error. The server is windows 2008 R2 with IIS7
EDIT: Bothe ILoggingService & IConfigSettings are both bound in Singleton Scope by Ninject (If That Helps)
Anyone get any pointers on what i should look for?
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
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:
[NullReferenceException: Object reference not set to an instance of an object.]
DataPortal.Models.Repositories.KpiRepository..ctor(ILoggingService ls, IConfigSettings configSettings) +1295
DynamicInjector3f592a0195c345d8a7d555c4c4085e12(Object[] ) +128
Ninject.Activation.Context.Resolve() +279
System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +237
System.Linq.Enumerable.SingleOrDefault(IEnumerable`1 source) +298
System.Linq.WhereSelectArrayIterator`2.MoveNext() +109
System.Linq.Buffer`1..ctor(IEnumerable`1 source) +487
System.Linq.Enumerable.ToArray(IEnumerable`1 source) +103
Ninject.Activation.Providers.StandardProvider.Create(IContext context) +479
Ninject.Activation.Context.Resolve() +279
System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +237
System.Linq.Enumerable.SingleOrDefault(IEnumerable`1 source) +298
System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +67
[InvalidOperationException: An error occurred when trying to create a controller of type 'DataPortal.Controllers.KpiController'. Make sure that the controller has a parameterless public constructor.]
System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +247
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +85
System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +280
System.Web.Mvc.<>c__DisplayClass6.<BeginProcessRequest>b__2() +66
System.Web.Mvc.<>c__DisplayClassb`1.<ProcessInApplicationTrust>b__a() +19
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Func`1 func) +161
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +405
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375
it was a dependency issue in the end. The project had a dependency on another project that hadn't been deployed.
It seems one of your argument "LoggingService or ConfigSettings" is not configured properly in your web.config. Check your previous working version config file.
In some cases it can be related to a problem with the database for example :
a select which returns a null value without a correct exception handling would cause the same error. Therefore,one needs to check his sql requests.