[Mono-dev] Fwd: Mono 1.1 and 2.0 runtimes and SessionState

Savva savvkin at gmail.com
Thu Jun 7 04:43:26 EDT 2007


Hello.
I use openSUSE 10.2 image from site + daily monocharge binaries +
system auto update

I managed to compile ASP.NET 2.0 Web-Service under Apache + mod_mono,
but it still not working...

1. If I use those settings (in etc/apache2/server-default.conf), my
service runs under Mono Runtime 2.0. Is those settings are correct?

Alias /mstest /srv/www/htdocs/monoservice
MonoApplications msdefault "/mstest:/srv/www/htdocs/monoservice"
MonoServerPath msdefault "/usr/bin/mod-mono-server2"
<Directory /srv/www/htdocs/monoservice>
        Allow from all
         Order allow,deny
        SetHandler mono
        MonoSetServerAlias msdefault
</Directory>

2. Why do I get 2 pairs of methods are generated on page in case of runtime 2.0?

Methods
HelloWorld
HelloWorld2

and

Methods for MyServiceSoap12
HelloWorld
HelloWorld2

3. When I try to test any method with test form I get following error
(after about 60 sec of waiting):
--- start here ---
The remote server returned an error: (500) Internal Server Error.
<?xml version=" 1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html
       xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
lang="en"><head><title>Error
       500</title><style type="text/css">body
{font-family:"Verdana","DejaVu Sans",
     sans-serif;font-weight:normal;font-size:
.7em;color:black;background-color: white}
p {font-family:"Verdana","DejaVu
Sans",sans-serif;font-weight:normal;color:black;margin-top:
       -5px}
b {font-family:"Verdana","DejaVu
Sans",sans-serif;font-weight:bold;color:black;margin-top: -5px}
h1 { font-family:"Verdana","DejaVu
Sans",sans-serif;font-weight:normal;font-size:18pt;color:red
       }
h2 { font-family:"Verdana","DejaVu Sans",
      sans-serif;font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:"Lucida Console","DejaVu Sans Mono",
monospace;font-size:  1.2em}
div.bodyText {font-family: "Verdana","DejaVu Sans",sans-serif}
 table.sampleCode  100%; background-color: #ffffcc;
.errorText  red; font-weight: bold
 .marker {font-weight: bold; color: black;text-decoration: none;}
.version  gray;
 .error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy;
cursor:hand;
       }</style></head><body><h1>Server Error in '/mstest' Application</h1><hr
       style="color: silver"/><h2><em>Object reference not set to an
instance of an
      object</em></h2>
<p><strong>Description: </strong>Error processing request.</p>
 <p><strong>Error Message: </strong>HTTP 500.
System.NullReferenceException: Object reference
      not set to an instance of an object
</p>
<p><strong>Stack Trace: </strong></p><table summary="Stack Trace"
class="sampleCode">
<tr><td><pre>System.NullReferenceException: Object reference not set
to an instance of an object
   at System.Web.SessionState.SessionInProcHandler.SetAndReleaseItemExclusive (
       System.Web.HttpContext  context, System.String id,
        System.Web.SessionState.SessionStateStoreData item,
System.Object lockId, Boolean
         newItem) [0x00000] </pre></td></tr>
</table>
 <![CDATA[
System.Web.HttpException:  ---> System.NullReferenceException: Object
reference not set to
      an instance of an object
  at System.Web.SessionState.SessionInProcHandler.SetAndReleaseItemExclusive  (
       System.Web.HttpContext context, System.String id,
         System.Web.SessionState.SessionStateStoreData item,
System.Object lockId, Boolean
        newItem) [0x00000] --- End of inner exception stack trace ---

]]>
<hr style="color: silver"/>02/17/2009 12:43:47</body></html>
--- end here ---

4. If I switch off SessionState or comment out config (and make it
1.1), it works

<sessionState mode="Off" cookieless="false" timeout="30" />

OR

#Alias /mstest /srv/www/htdocs/monoservice
 #MonoApplications msdefault "/mstest:/srv/www/htdocs/monoservice"
 #MonoServerPath msdefault "/usr/bin/mod-mono-server2"
#<Directory /srv/www/htdocs/monoservice>
 #        Allow from all
 #        Order allow,deny
#        SetHandler mono
 #        MonoSetServerAlias msdefault
#</Directory>

I have no idea how to fix all that... Please help.

This is src of my web service

--- start here ---
 using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Web;
 using System.Collections;
using System.Web.Services;
 using System.Web.Services.Protocols;
using System.ComponentModel;

 namespace MonoService
{

    [WebService(Namespace = " http://www.ru/", Name =
"MyApplicationServer", Description = "test")]
    //[WebServiceBinding(ConformsTo =  WsiProfiles.BasicProfile1_1)]
    public class Service1 : System.Web.Services.WebService
     {
        [WebMethod(EnableSession=true)]
        public DataSet HelloWorld(string query)
        {
            Session.Add("lastquery", query);
            SqlConnection conn = new
System.Data.SqlClient.SqlConnection(@"my conn string");
             SqlDataAdapter adap = new SqlDataAdapter(query, conn);
             DataSet ds = new DataSet();
            adap.Fill(ds);
             return ds;
        }
         [WebMethod(EnableSession = true)]
        public string HelloWorld2()
         {
            string lastquery = "";
            try
            {
                lastquery = Session["lastquery"].ToString();
            }
            catch (Exception ex)
             {
                lastquery = "Error: " + ex.ToString();
             }

            return lastquery;
         }
    }
}
--- end here ---



More information about the Mono-devel-list mailing list