How to deploy an ASP.NET website with a Linq to Sql component -


i have .net 3.5 web application added linq sql functionality -- dbml file, etc. locally, works fine.

however, when try deploy it, null reference exception, apparently when it's trying call constructor context object.

to add complexity, use web deployment project compiles single dll. assumed linq sql stuff compiled along else. however, i'm thinking need move dbml file along dll.

i had dbml file in app_code directory, tried recreating directory structure on remote server. .net not let me have app_code directory on precompiled application. moved dbml file root directory -- still error.

help!

here's stack trace error i'm getting:

[nullreferenceexception: object reference not set instance of object.] codecs.sarcstatedatadatacontext..ctor() +28 db_interface.sarcstatedatadb..ctor() +26 esarc_basic..ctor() +56 asp.esarc_basic_aspx..ctor() +14 __asp.fastobjectfactory_sarcwriting.create_asp_esarc_basic_aspx() +20 system.web.compilation.buildresultcompiledtype.createinstance() +32 system.web.compilation.buildmanager.createinstancefromvirtualpath(virtualpath virtualpath, type requiredbasetype, httpcontext context, boolean allowcrossapp, boolean noassert) +119 system.web.ui.pagehandlerfactory.gethandlerhelper(httpcontext context, string requesttype, virtualpath virtualpath, string physicalpath) +33 system.web.ui.pagehandlerfactory.system.web.ihttphandlerfactory2.gethandler(httpcontext context, string requesttype, virtualpath virtualpath, string physicalpath) +40 system.web.httpapplication.maphttphandler(httpcontext context, string requesttype, virtualpath path, string pathtranslated, boolean useappconfig) +160 system.web.maphandlerexecutionstep.system.web.httpapplication.iexecutionstep.execute() +93 system.web.httpapplication.executestep(iexecutionstep step, boolean& completedsynchronously) +155

db_interface.sarcstatedatadb class wrote calls constructor context object:

codecs.sarcstatedatadatacontext context = new sarcstatedatadatacontext();

i don't send connection string or connection object, because both local , deployed versions of program use same remote database. problem? local application has access connection string in dbml file, deployed application doesn't ... ??

update: looked @ code in reflector , getting connection string web.config, , looks copasetic on issue ...

ok, found problem! connection string name looking -- sarcwritingconnectionstring -- apparently linq sql had added web.config when setting initially, going through wizard. , did not move new web.config server when deployed project, because thought had not changed. when move up, works!

(i used data connection had set in server explorer instead of connection string in web.config -- wasn't sure how that.)

thanks -- it's know don't need move dbml file. next time easier!


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -