{"id":7343,"date":"2014-06-07T02:29:36","date_gmt":"2014-06-07T02:29:36","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/06\/07\/dblinq-reference-in-asp-net-web-service-on-monodevelop-causes-xsp2-to-fault-collection-of-common-programming-errors\/"},"modified":"2014-06-07T02:29:36","modified_gmt":"2014-06-07T02:29:36","slug":"dblinq-reference-in-asp-net-web-service-on-monodevelop-causes-xsp2-to-fault-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/06\/07\/dblinq-reference-in-asp-net-web-service-on-monodevelop-causes-xsp2-to-fault-collection-of-common-programming-errors\/","title":{"rendered":"Dblinq reference in ASP.NET Web Service on MonoDevelop causes xsp2 to fault-Collection of common programming errors"},"content":{"rendered":"<p>I am trying to try DBLinq with the sqlite provider inside a simple ASP.NET web service. I am also using MonoDevelop 2.4 and Mono 2.6.7, The project in monodevelop references the DbLinq.dll which by default is set to be Local Copy. I can compile the webservice just fine. By when I try to run it from Monodevelop or using the xsp2 from the command line, xsp2 fails with a number of errors (see below). If I unchecked the Local Copy for the DBLinq.dll reference, xsp2 will execute but the Linq portion of the code does not work. This is also true for the MySQL provider. I think the problem is the when DbLinq is referenced and be locally copied, it also copies the dependent assemblies and one of the assembly is causing xsp2 to choke.<\/p>\n<p>Has anyone encountered this? How can I fix the problem or what is the workaround? Any help is very much appreciated. Below is the sample snippet of the webservice method in the asmx code behind.<\/p>\n<blockquote>\n<p>[WebMethod]<br \/>\npublic string getrecord() {<\/p>\n<pre><code>string txt = string.Empty; \n\nusing( DataContext context = \n   new DataContext(\"DbLinqProvider=Sqlite; Data Source=openemr.db\")) \n    {\n            var addrtbl = context.GetTable(); \n            var addr = from a in addrtbl \n                    select a; \n            foreach( var i in addr) \n            { \n                    txt += i.City ; \n                    txt += \"; \"; \n            } \n    } \n<\/code><\/pre>\n<p>return txt;<br \/>\n}<\/p>\n<\/blockquote>\n<p>Of course, this might not be a good way to implement data access and will need to separate the concerns. But for testing purposes, this should at least work.<\/p>\n<p>Here is the error I get when I run xsp2. As I said above, one of the dependent assemblies that DbLinq references and copied locally is causing this to happen. My question is how do I best fix this so it works?<\/p>\n<p>user@ubuntu:~\/Projects\/WebService\/WebService$ xsp2 &#8211;address 127.0.0.1 &#8211;port 8889<\/p>\n<p>** (\/usr\/lib\/mono\/2.0\/xsp2.exe:2566): WARNING **: Missing method System.Web.Configuration.WebConfigurationManager::get_AppSettings() in assembly \/usr\/lib\/mono\/gac\/System.Web\/2.0.0.0_<em>b03f5f7f11d50a3a\/ System.Web.dll, referenced in assembly \/usr\/lib\/mono\/gac\/Mono.Web\/ 2.0.0.0<\/em>_0738eb9f132ed756\/Mono.Web.dll<\/p>\n<p>** (\/usr\/lib\/mono\/2.0\/xsp2.exe:2566): WARNING **: Missing method System.Configuration.ConfigurationProperty::.ctor(string,Type,object,TypeCo\u00adnverter,ConfigurationValidatorBase,ConfigurationPropertyOptions) in assembly \/home\/ellory\/Projects\/WebService\/WebService\/bin\/ System.Configuration.dll, referenced in assembly \/usr\/lib\/mono\/gac\/ System.Web\/2.0.0.0__b03f5f7f11d50a3a\/System.Web.dll<\/p>\n<p>** (\/usr\/lib\/mono\/2.0\/xsp2.exe:2566): WARNING **: Missing method System.Configuration.ConfigurationProperty::.ctor(string,Type,object,TypeCo\u00adnverter,ConfigurationValidatorBase,ConfigurationPropertyOptions) in assembly \/home\/ellory\/Projects\/WebService\/WebService\/bin\/ System.Configuration.dll, referenced in assembly \/usr\/lib\/mono\/gac\/ System.Web\/2.0.0.0__b03f5f7f11d50a3a\/System.Web.dll<\/p>\n<p>** (\/usr\/lib\/mono\/2.0\/xsp2.exe:2566): WARNING **: Missing method System.Configuration.ConfigurationProperty::.ctor(string,Type,object,TypeCo\u00adnverter,ConfigurationValidatorBase,ConfigurationPropertyOptions) in assembly \/home\/ellory\/Projects\/WebService\/WebService\/bin\/ System.Configuration.dll, referenced in assembly \/usr\/lib\/mono\/gac\/ System.Web\/2.0.0.0__b03f5f7f11d50a3a\/System.Web.dll<\/p>\n<p>** (\/usr\/lib\/mono\/2.0\/xsp2.exe:2566): WARNING **: Missing method System.Configuration.ConfigurationProperty::.ctor(string,Type,object,TypeCo\u00adnverter,ConfigurationValidatorBase,ConfigurationPropertyOptions) in assembly \/home\/ellory\/Projects\/WebService\/WebService\/bin\/ System.Configuration.dll, referenced in assembly \/usr\/lib\/mono\/gac\/ System.Web\/2.0.0.0__b03f5f7f11d50a3a\/System.Web.dll Handling exception type TargetInvocationException Message is Exception has been thrown by the target of an invocation. IsTerminating is set to True System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.<\/p>\n<p>Server stack trace: at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0 at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0 at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000] in :0 at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in :0 at System.Configuration.ConfigInfo.CreateInstance () [0x00000] in :0 at System.Configuration.SectionInfo.CreateInstance () [0x00000] in :0 at System.Configuration.Configuration.GetSectionInstance (System.Configuration.SectionInfo config, Boolean createDefaultInstance) [0x00000] in :0 at System.Configuration.ConfigurationSectionCollection.get_Item (System.String name) [0x00000] in :0 at System.Configuration.Configuration.GetSection (System.String path) [0x00000] in :0 at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName, System.String path, System.Web.HttpContext context) [0x00000] in :0 at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName, System.String path) [0x00000] in :0 at System.Web.Configuration.WebConfigurationManager.GetWebApplicationSection (System.String sectionName) [0x00000] in :0 at System.Web.Hosting.ApplicationHost.SetHostingEnvironment () [0x00000] in :0 at System.AppDomain.DoCallBack (System.CrossAppDomainDelegate callBackDelegate) [0x00000] in :0 at (wrapper remoting-invoke-with-check) System.AppDomain:DoCallBack (System.CrossAppDomainDelegate) at (wrapper xdomain-dispatch) System.AppDomain:DoCallBack (object,byte[]&amp;,byte[]&amp;)<\/p>\n<p>Exception rethrown at [0]: &#8212;&gt; System.TypeInitializationException: An exception was thrown by the type initializer for System.Web.Configuration.HostingEnvironmentSection &#8212;&gt; System.MissingMethodException: Method not found: &#8216;System.Configuration.ConfigurationProperty..ctor&#8217;. &#8212; End of inner exception stack trace &#8212; at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (object,object[],System.Exception&amp;) at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0 &#8212; End of inner exception stack trace &#8212; at (wrapper xdomain-invoke) System.AppDomain:DoCallBack (System.CrossAppDomainDelegate) at (wrapper remoting-invoke-with-check) System.AppDomain:DoCallBack (System.CrossAppDomainDelegate) at System.Web.Hosting.ApplicationHost.CreateApplicationHost (System.Type hostType, System.String virtualDir, System.String physicalDir) [0x00000] in :0 at Mono.WebServer.VPathToHost.CreateHost (Mono.WebServer.ApplicationServer server, Mono.WebServer.WebSource webSource) [0x00000] in :0 at Mono.WebServer.XSP.Server.RealMain (System.String[] args, Boolean root, IApplicationHost ext_apphost, Boolean quiet) [0x00000] in :0 at (wrapper remoting-invoke-with-check) Mono.WebServer.XSP.Server:RealMain (string[],bool,Mono.WebServer.IApplicationHost,bool) at Mono.WebServer.XSP.Server.Main (System.String[] args) [0x00000] in :0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am trying to try DBLinq with the sqlite provider inside a simple ASP.NET web service. I am also using MonoDevelop 2.4 and Mono 2.6.7, The project in monodevelop references the DbLinq.dll which by default is set to be Local Copy. I can compile the webservice just fine. By when I try to run it [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7343","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7343","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7343"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7343\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}