I am trying to use Linq to SqLite inside a simple ASP.NET web
service. I am also using MonoDevelop 2.4 and ono 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 works instead the Linq portion
of the code does not work. I think the problem is the when DbLinq is
referenced and be locally copied, it also copies the dependent
assembly and one of the assembly is causing xsp2 to choke.
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.
[WebMethod]
public string getrecord()
{
string txt = string.Empty;
using( DataContext context = new DataContext("DbLinqProvider=Sqlite;
Data Source=openemr.db"))
{
var addrtbl = context.GetTable<Addresses>();
var addr = from a in addrtbl
select a;
foreach( var i in addr)
{
txt += i.City ;
txt += "; ";
}
}
return txt;
}
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.
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?
ell...@ubuntu:~/Projects/WebService/WebService$ xsp2 --address
127.0.0.1 --port 8889
** (/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__b03f5f7f11d50a3a/
System.Web.dll, referenced in assembly /usr/lib/mono/gac/Mono.Web/
2.0.0.0__0738eb9f132ed756/Mono.Web.dll
** (/usr/lib/mono/2.0/xsp2.exe:2566): WARNING **: Missing method
System.Configuration.ConfigurationProperty::.ctor(string,Type,object,TypeConverter,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
** (/usr/lib/mono/2.0/xsp2.exe:2566): WARNING **: Missing method
System.Configuration.ConfigurationProperty::.ctor(string,Type,object,TypeConverter,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
** (/usr/lib/mono/2.0/xsp2.exe:2566): WARNING **: Missing method
System.Configuration.ConfigurationProperty::.ctor(string,Type,object,TypeConverter,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
** (/usr/lib/mono/2.0/xsp2.exe:2566): WARNING **: Missing method
System.Configuration.ConfigurationProperty::.ctor(string,Type,object,TypeConverter,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.
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 <filename unknown>:0
at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr,
System.Reflection.Binder binder, System.Object[] parameters,
System.Globalization.CultureInfo culture) [0x00000] in <filename
unknown>:0
at System.Reflection.ConstructorInfo.Invoke (System.Object[]
parameters) [0x00000] in <filename unknown>:0
at System.Activator.CreateInstance (System.Type type, Boolean
nonPublic) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigInfo.CreateInstance () [0x00000] in
<filename unknown>:0
at System.Configuration.SectionInfo.CreateInstance () [0x00000] in
<filename unknown>:0
at System.Configuration.Configuration.GetSectionInstance
(System.Configuration.SectionInfo config, Boolean
createDefaultInstance) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationSectionCollection.get_Item
(System.String name) [0x00000] in <filename unknown>:0
at System.Configuration.Configuration.GetSection (System.String
path) [0x00000] in <filename unknown>:0
at System.Web.Configuration.WebConfigurationManager.GetSection
(System.String sectionName, System.String path, System.Web.HttpContext
context) [0x00000] in <filename unknown>:0
at System.Web.Configuration.WebConfigurationManager.GetSection
(System.String sectionName, System.String path) [0x00000] in <filename
unknown>:0
at
System.Web.Configuration.WebConfigurationManager.GetWebApplicationSection
(System.String sectionName) [0x00000] in <filename unknown>:0
at System.Web.Hosting.ApplicationHost.SetHostingEnvironment ()
[0x00000] in <filename unknown>:0
at System.AppDomain.DoCallBack (System.CrossAppDomainDelegate
callBackDelegate) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.AppDomain:DoCallBack
(System.CrossAppDomainDelegate)
at (wrapper xdomain-dispatch) System.AppDomain:DoCallBack
(object,byte[]&,byte[]&)
Exception rethrown at [0]:
---> System.TypeInitializationException: An exception was thrown by
the type initializer for
System.Web.Configuration.HostingEnvironmentSection --->
System.MissingMethodException: Method not found:
'System.Configuration.ConfigurationProperty..ctor'.
--- End of inner exception stack trace ---
at (wrapper managed-to-native)
System.Reflection.MonoCMethod:InternalInvoke
(object,object[],System.Exception&)
at System.Reflection.MonoCMethod.Invoke (System.Object obj,
BindingFlags invokeAttr, System.Reflection.Binder binder,
System.Object[] parameters, System.Globalization.CultureInfo culture)
[0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
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 <filename unknown>:0
at Mono.WebServer.VPathToHost.CreateHost
(Mono.WebServer.ApplicationServer server, Mono.WebServer.WebSource
webSource) [0x00000] in <filename unknown>:0
at Mono.WebServer.XSP.Server.RealMain (System.String[] args, Boolean
root, IApplicationHost ext_apphost, Boolean quiet) [0x00000] in
<filename unknown>: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 <filename unknown>:0
--
You received this message because you are subscribed to the Google Groups
"DbLinq" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/dblinq?hl=en.