asp.net - System.AccessViolationException in .NET 4.0 while connecting to SQL Database -


i have created following code

    dim connectionstring string = configurationmanager.connectionstrings("default").connectionstring     dim con new sqlconnection(connectionstring)     con.open()     response.write("connection opened<br/>")     con.close()     response.write("connection closed<br/>") 

in web application project target .net framework 4.0 giving system.accessviolationexception cannot understand why.

if change target framework .net 3.0 code runs fine.

below detailed exception

system.accessviolationexception unhandled hresult=-2147467261 message=attempted read or write protected memory. indication other memory corrupt. source=system.data stacktrace:    @ sniaddprovider(sni_conn* , providernum , void* )    @ sninativemethodwrapper.sniaddprovider(safehandle pconn, providerenum providerenum, uint32& info)    @ system.data.sqlclient.tdsparser.consumepreloginhandshake(boolean encrypt, boolean trustservercert, boolean integratedsecurity, boolean& marscapable)    @ system.data.sqlclient.tdsparser.connect(serverinfo serverinfo, sqlinternalconnectiontds connhandler, boolean ignoresniopentimeout, int64 timerexpire, boolean encrypt, boolean trustservercert, boolean integratedsecurity, boolean withfailover)    @ system.data.sqlclient.sqlinternalconnectiontds.attemptonelogin(serverinfo serverinfo, string newpassword, securestring newsecurepassword, boolean ignoresniopentimeout, timeouttimer timeout, boolean withfailover)    @ system.data.sqlclient.sqlinternalconnectiontds.loginnofailover(serverinfo serverinfo, string newpassword, securestring newsecurepassword, boolean redirecteduserinstance, sqlconnectionstring connectionoptions, sqlcredential credential, timeouttimer timeout)    @ system.data.sqlclient.sqlinternalconnectiontds.openloginenlist(timeouttimer timeout, sqlconnectionstring connectionoptions, sqlcredential credential, string newpassword, securestring newsecurepassword, boolean redirecteduserinstance)    @ system.data.sqlclient.sqlinternalconnectiontds..ctor(dbconnectionpoolidentity identity, sqlconnectionstring connectionoptions, sqlcredential credential, object providerinfo, string newpassword, securestring newsecurepassword, boolean redirecteduserinstance, sqlconnectionstring userconnectionoptions)    @ system.data.sqlclient.sqlconnectionfactory.createconnection(dbconnectionoptions options, dbconnectionpoolkey poolkey, object poolgroupproviderinfo, dbconnectionpool pool, dbconnection owningconnection, dbconnectionoptions useroptions)    @ system.data.providerbase.dbconnectionfactory.createpooledconnection(dbconnectionpool pool, dbconnectionoptions options, dbconnectionpoolkey poolkey, dbconnectionoptions useroptions)    @ system.data.providerbase.dbconnectionpool.createobject(dbconnectionoptions useroptions)    @ system.data.providerbase.dbconnectionpool.usercreaterequest(dbconnectionoptions useroptions)    @ system.data.providerbase.dbconnectionpool.trygetconnection(dbconnection owningobject, uint32 waitformultipleobjectstimeout, boolean allowcreate, boolean onlyonecheckconnection, dbconnectionoptions useroptions, dbconnectioninternal& connection)    @ system.data.providerbase.dbconnectionpool.trygetconnection(dbconnection owningobject, taskcompletionsource`1 retry, dbconnectionoptions useroptions, dbconnectioninternal& connection)    @ system.data.providerbase.dbconnectionfactory.trygetconnection(dbconnection owningconnection, taskcompletionsource`1 retry, dbconnectionoptions useroptions, dbconnectioninternal& connection)    @ system.data.providerbase.dbconnectionclosed.tryopenconnection(dbconnection outerconnection, dbconnectionfactory connectionfactory, taskcompletionsource`1 retry, dbconnectionoptions useroptions)    @ system.data.sqlclient.sqlconnection.tryopen(taskcompletionsource`1 retry)    @ system.data.sqlclient.sqlconnection.open()    @ corruptedmemorytest._default.page_load(object sender, eventargs e) in e:\azure migration\azuretest\corruptedmemorytest\default.aspx.vb:line 9    @ system.web.ui.control.onload(eventargs e)    @ system.web.ui.control.loadrecursive()    @ system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint)    @ system.web.ui.page.processrequest(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint)    @ system.web.ui.page.processrequest()    @ system.web.ui.page.processrequestwithnoassert(httpcontext context)    @ system.web.ui.page.processrequest(httpcontext context)    @ asp.default_aspx.processrequest(httpcontext context)    @ system.web.httpapplication.callhandlerexecutionstep.system.web.httpapplication.iexecutionstep.execute()    @ system.web.httpapplication.executestep(iexecutionstep step, boolean& completedsynchronously)    @ system.web.httpapplication.applicationstepmanager.resumesteps(exception error)    @ system.web.httpapplication.system.web.ihttpasynchandler.beginprocessrequest(httpcontext context, asynccallback cb, object extradata)    @ system.web.httpruntime.processrequestinternal(httpworkerrequest wr)    @ system.web.httpruntime.processrequestnodemand(httpworkerrequest wr)    @ system.web.httpruntime.processrequest(httpworkerrequest wr)    @ microsoft.visualstudio.webhost.request.process()    @ microsoft.visualstudio.webhost.host.processrequest(connection conn)    @ microsoft.visualstudio.webhost.host.processrequest(connection conn)    @ microsoft.visualstudio.webhost.server.onsocketaccept(object acceptedsocket)    @ system.threading.queueuserworkitemcallback.waitcallback_context(object state)    @ system.threading.executioncontext.runinternal(executioncontext executioncontext, contextcallback callback, object state, boolean preservesyncctx)    @ system.threading.executioncontext.run(executioncontext executioncontext, contextcallback callback, object state, boolean preservesyncctx)    @ system.threading.queueuserworkitemcallback.system.threading.ithreadpoolworkitem.executeworkitem()    @ system.threading.threadpoolworkqueue.dispatch()    @ system.threading._threadpoolwaitcallback.performwaitcallback()    innerexception:  

i spent week tearing hair out , trying sorts of desperate measures. able fix uninstalling program monitoring network traffic (cucusoft net guard). program seems interfere in packet traffic , causing error. uninstalling app fixed problem, but, curiously, turning off did not. must have installed low level filter in place , causing problem when app not running.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -