c# - EntityConnection error The specified named connection is either not found in the configuration -
well, know there topic that, believe me - tried , still didn't answer how solve issue.
error: specified named connection either not found in configuration, not intended used entityclient provider, or not valid.
in app.config have connection string:
<add name="getproductsentities" connectionstring="metadata=res://*/getproductsmodel.csdl|res://*/getproductsmodel.ssdl|res://*/getproductsmodel.msl;provider=system.data.sqlclient;provider connection string="data source=(local);initial catalog=maindb;integrated security=true;multipleactiveresultsets=true;app=entityframework"" providername="system.data.entityclient" />
samae in model when click properties:
metadata=res://*/getproductsmodel.csdl|res://*/getproductsmodel.ssdl|res://*/getproductsmodel.msl;provider=system.data.sqlclient;provider connection string="data source=(local);initial catalog=maindb;integrated security=true;multipleactiveresultsets=true;app=entityframework"
in pc works great. when copy executable file friend pc, im having errors:
inerexception:
source: system.data.entity
stacktrace: w system.data.entityclient.entityconnection.changeconnectionstring(string newconnectionstring) w system.data.entityclient.entityconnection..ctor(string connectionstring) w system.data.objects.objectcontext.createentityconnection(string connectionstring) w xxxxx.additions.getproductsentities..ctor()
w xxxxx.additions.getreturnentities.returnproductentities(nullable1 cid, nullable
1 wid) w xxxxx.loginwindow.loadentities() w xxxxx.loginwindow.window_loaded(object sender, routedeventargs e) w system.windows.routedeventhandlerinfo.invokehandler(object target, routedeventargs routedeventargs) w system.windows.eventroute.invokehandlersimpl(object source, routedeventargs args, boolean reraised) w system.windows.uielement.raiseeventimpl(dependencyobject sender, routedeventargs args) w system.windows.uielement.raiseevent(routedeventargs e) w system.windows.broadcasteventhelper.broadcastevent(dependencyobject root, routedevent routedevent) w system.windows.broadcasteventhelper.broadcastloadedevent(object root) w ms.internal.loadedorunloadedoperation.dowork() w system.windows.media.mediacontext.fireloadedpendingcallbacks() w system.windows.media.mediacontext.fireinvokeonrendercallbacks() w system.windows.media.mediacontext.rendermessagehandlercore(object resizedcompositiontarget) w system.windows.media.mediacontext.rendermessagehandler(object resizedcompositiontarget) w system.windows.media.mediacontext.resize(icompositiontarget resizedcompositiontarget) w system.windows.interop.hwndtarget.onresize() w system.windows.interop.hwndtarget.handlemessage(windowmessage msg, intptr wparam, intptr lparam) w system.windows.interop.hwndsource.hwndtargetfiltermessage(intptr hwnd, int32 msg, intptr wparam, intptr lparam, boolean& handled) w ms.win32.hwndwrapper.wndproc(intptr hwnd, int32 msg, intptr wparam, intptr lparam, boolean& handled) w ms.win32.hwndsubclass.dispatchercallbackoperation(object o) w system.windows.threading.exceptionwrapper.internalrealcall(delegate callback, object args, int32 numargs) w ms.internal.threading.exceptionfilterhelper.trycatchwhen(object source, delegate method, object args, int32 numargs, delegate catchhandler)targetsite: void changeconnectionstring(system.string)
data: system.collections.listdictionaryinternal
-------------------------------------------------------------------------------------------- system.argumentexception stos: (stack) w system.data.entityclient.entityconnection.changeconnectionstring(system.string) w system.data.entityclient.entityconnection..ctor(system.string) w system.data.objects.objectcontext.createentityconnection(system.string) w xxxxx.getproductsentities..ctor() w xxxxx.additions.getreturnentities.returnproductentities(system.nullable
1<int32>, system.nullable
1) w xxxxx.app.loadentities() w xxxxx.app.onstartup(system.windows.startupeventargs) w system.windows.application.<.ctor>b__1(system.object) w system.windows.threading.exceptionwrapper.internalrealcall(system.delegate, system.object, int32) w ms.internal.threading.exceptionfilterhelper.trycatchwhen(system.object, system.delegate, system.object, int32, system.delegate) w system.windows.threading.dispatcheroperation.invokeimpl() w system.windows.threading.dispatcheroperation.invokeinsecuritycontext(system.object) w system.threading.executioncontext.runinternal(system.threading.executioncontext, system.threading.contextcallback, system.object, boolean) w system.threading.executioncontext.run(system.threading.executioncontext, system.threading.contextcallback, system.object, boolean) w system.threading.executioncontext.run(system.threading.executioncontext, system.threading.contextcallback, system.object) w system.windows.threading.dispatcheroperation.invoke() w system.windows.threading.dispatcher.processqueue() w system.windows.threading.dispatcher.wndprochook(intptr, int32, intptr, intptr, boolean byref) w ms.win32.hwndwrapper.wndproc(intptr, int32, intptr, intptr, boolean byref) w ms.win32.hwndsubclass.dispatchercallbackoperation(system.object) w system.windows.threading.exceptionwrapper.internalrealcall(system.delegate, system.object, int32) w ms.internal.threading.exceptionfilterhelper.trycatchwhen(system.object, system.delegate, system.object, int32, system.delegate) w system.windows.threading.dispatcher.legacyinvokeimpl(system.windows.threading.dispatcherpriority, system.timespan, system.delegate, system.object, int32) w ms.win32.hwndsubclass.subclasswndproc(intptr, int32, intptr, intptr)
w ms.win32.unsafenativemethods.dispatchmessage(system.windows.interop.msg byref) w system.windows.threading.dispatcher.pushframeimpl(system.windows.threading.dispatcherframe) w system.windows.threading.dispatcher.pushframe(system.windows.threading.dispatcherframe) w system.windows.threading.dispatcher.run() w system.windows.application.rundispatcher(system.object) w system.windows.application.runinternal(system.windows.window) w system.windows.application.run(system.windows.window) w xxxxx.app.main()
at momment model in same folder app.config. tried copy connectionstring directly
public getproductsentities() : base("name=getproductsentities", "getproductsentities")
but still have errors data source not proper value connection string etc..
help me, please.
thanks!
Comments
Post a Comment