Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Restarting Service Fails
orem
#1 Posted : Thursday, March 15, 2007 8:08:56 AM(UTC)
Groups: Member
Joined: 3/15/2007(UTC)
Posts: 3
Location: Orem

The company I work for is currently using the UltiDev Cassini web server as an intranet web server. We have found that when using the two most recent versions of UltiDev Cassini, we are unable to restart the service successfully, consistently. Several times, the service will appear to have restarted successfully, but we are unable to access any web pages via the web server other than the admin page (http://localhost:7756). We have reproduced this behavior on a clean install of Windows XP Professional with only a basic html file as the page to be served. We created a test application that starts the service, attempts to access the test html page, then stops the service and tries again. We are starting and stopping the service using net start and net stop. Intermittently, this test fails, but a subsequent restart of the service seems to resolve the problem. This has been problematic for us in our production environments where frequent updates to content require stopping and starting the Cassini service. I greatly appreciate any assistance you can provide on resolving this matter.
Ultidev Team
#2 Posted : Thursday, March 15, 2007 12:24:56 PM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Hi,

Could you please take a look into the Windows Event Log (Application) and see whether there are error entries related to UltiDev Cassini. The best way to test is to clean up the event log and then restart the service.

Another point to make is it's not required to stop Cassini while updating web site files.

Please let us know if event log contains anything relevant.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
orem
#3 Posted : Friday, March 16, 2007 12:20:00 PM(UTC)
Groups: Member
Joined: 3/15/2007(UTC)
Posts: 3
Location: Orem

We do not have any entries in the application log for UltiDev Cassini. We have to restart the service because we are replacing files that the web server has open. The files cannot be changed while a process has them open.
Ultidev Team
#4 Posted : Friday, March 16, 2007 2:41:28 PM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Let us re-cap the situation:
- You've registered your application with Cassini;
- You can see it when you run Cassini Explorer at http://localhot:7756/
- Application works until you restart the service;
- Sometimes after restarting application clicking application link in Cassini Explorer returns error.

We are a bit puzzled because if service started, all its applications are usually available within a minute or so. We would appreciate if you could provide any additional error information, like error screenshot, Cassini Explorer screenshot showing application registration, and application event log showing Cassini service starting and loading applications. If you don't mind sending us this information, contact us via email so you could attach files to the message after we respond.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
mikki
#5 Posted : Tuesday, August 5, 2008 12:12:03 AM(UTC)
Groups: Member
Joined: 8/5/2008(UTC)
Posts: 4
Location: Poland

orem wrote:
The company I work for is currently using the UltiDev Cassini web server as an intranet web server. We have found that when using the two most recent versions of UltiDev Cassini, we are unable to restart the service successfully, consistently. Several times, the service will appear to have restarted successfully, but we are unable to access any web pages via the web server other than the admin page (http://localhost:7756). We have reproduced this behavior on a clean install of Windows XP Professional with only a basic html file as the page to be served. We created a test application that starts the service, attempts to access the test html page, then stops the service and tries again. We are starting and stopping the service using net start and net stop. Intermittently, this test fails, but a subsequent restart of the service seems to resolve the problem. This has been problematic for us in our production environments where frequent updates to content require stopping and starting the Cassini service. I greatly appreciate any assistance you can provide on resolving this matter.


We encountered similar situation. We use UltiDev Cassini 2.0

Our scenario is:
1. we stop UltiDev Cassini service (this is done via ServiceController - c# API) by a process with SYSTEM privileges (a process run by user SYSTEM)
2. we start UltiDev Cassini service (this is done via ServiceController too) by a process with SYSTEM privileges
3. UltiDev Cassini windows service restarts succesfully - the service status is RUNNING,

but we are unable to access any web pages via the web server, even the admin page (http://localhost:7756)!

Surprisingly, the same scenario executed by a process with admin privileges (run by admin user) succeeds.
Ultidev Team
#6 Posted : Tuesday, August 5, 2008 6:06:38 AM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Hi, Mikki.

We never saw this problem before, but we definitely will do our best to help you troubleshoot the problem.

- First, could you please compare Windows Event Log (Application) entries created by Cassini when you start Cassini services from interactive account vs entries created when the service is started by the process with System access? When Cassini loads an application, it creates an entry in the Windows Event Log. Please see whether you get an entry for loaded Cassini Explorer in each case. If you see error entries, please either copy & paste them into your next post.

- Second, let's try to find out whether it's a Cassini or ASP.NET/Framework problem. Please try your service start/stop test with IIS service instead of Cassini service and see if the behavior is any different.

- Please let us know what is the use case for having Cassini service restarted? Maybe we can suggest a way to accomplish what you need without restarting the service.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
mikki
#7 Posted : Wednesday, August 6, 2008 12:09:15 AM(UTC)
Groups: Member
Joined: 8/5/2008(UTC)
Posts: 4
Location: Poland

I browse my windows event log and I see a lots of errors:

first is information about successfully started Cassini service,
next two logs are errors:

original message (in polish):
Exception in Cassini web application [7756, "UltiDev Cassini Web Server Explorer"].
Exception:
System.Net.Sockets.SocketException: Tylko jedno użycie każdego adresu gniazda (protokół/adres sieciowy/port) jest normalnie dozwolone
w System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
w System.Net.Sockets.Socket.Bind(EndPoint localEP)
w Cassini.Server.Start()
w CassiniService.Service1.WebAppEntry.Start()

in english is something like that:
Exception in Cassini web application [7756, "UltiDev Cassini Web Server Explorer"].
Exception:
System.Net.Sockets.SocketException: Only one use of each socket address (protocol/net address/port) is normally permitted
in System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
in System.Net.Sockets.Socket.Bind(EndPoint localEP)
in Cassini.Server.Start()
in CassiniService.Service1.WebAppEntry.Start()


and after this is secod similar error, but it references to my web application ("current" is my webapp name):

Exception in Cassini web application [1635, "current"].
Exception:
System.Net.Sockets.SocketException: Tylko jedno użycie każdego adresu gniazda (protokół/adres sieciowy/port) jest normalnie dozwolone
w System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
w System.Net.Sockets.Socket.Bind(EndPoint localEP)
w Cassini.Server.Start()
w CassiniService.Service1.WebAppEntry.Start()

I need to restart Cassini because of updating my webapp. I have to stop Cassini service, swapp some dlls, and start it again. When I got new update, my webapp starts another process which stops Cassini service, updates files and starts Cassini. In this scenario that "another process" has SYSTEM privileges, because Cassini service has them too. When I starts the "another process" manually, eg. in windows command line, all succeeds - in this case "another process" has my privileges (no SYSTEM user, but normal admin user, because my user is in admin group).

Any suggestions? ;)

Ultidev Team
#8 Posted : Wednesday, August 6, 2008 4:47:02 AM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Hi there!

When you updating your application files, you don't need to stop and start the service. ASP.NET will see that underlying application files changed and will recompile the application on the next request.

However, if you must restart, the error indicates it's a timing issue, where unloading Cassini didn't manage to unbind sockets it was using before new instance of Cassini attempted to bind to the same ports. When you use ServiceController to stop the service, do you have a wait loop waiting for the service state to change to Stopped?

Please let us know.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
mikki
#9 Posted : Wednesday, August 6, 2008 5:26:32 AM(UTC)
Groups: Member
Joined: 8/5/2008(UTC)
Posts: 4
Location: Poland

My methods to start/stop service:

public static void StartService(ServiceController service)
{
if (service == null)
{
throw new ArgumentNullException("service");
}

if (service.Status == ServiceControllerStatus.Stopped || service.Status == ServiceControllerStatus.StopPending)
{
service.Start();
while (service.Status != ServiceControllerStatus.Running)
{
Thread.Sleep(100);
service.Refresh();
}
}
else
{
throw new ServiceAlreadyRunning();
}
}




public static void StopService(ServiceController service)
{
if (service == null)
{
throw new ArgumentNullException("service");
}

if (service.Status == ServiceControllerStatus.Running || service.Status == ServiceControllerStatus.StartPending)
{
service.Stop();
while (service.Status != ServiceControllerStatus.Stopped)
{
Thread.Sleep(100);
service.Refresh();
}
}
else
{
throw new ServiceNotRunning();
}
}


When I swap dlls without stopping Cassini, my webapp sometimes get status "Not running" (in Cassini Explorer)... Because of this I decided to scenario: stop-swap-start.

Ultidev Team
#10 Posted : Wednesday, August 6, 2008 5:37:57 AM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Hi there.

The starting and stopping of the service is done properly.

If you decide to use stop-swap-start approach, try introducing a delay between stop and start to let ports to be freed. Sometimes ports stay bound even after service is stopped - we saw this problem before but it's hard to reproduce reliably.

When you swapped files, does the application become "Not running" and stays "not running"? If so, check Windows Event Log to see if any errors or warning were added there at the time when you swapped the files.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
mikki
#11 Posted : Wednesday, August 13, 2008 12:37:42 AM(UTC)
Groups: Member
Joined: 8/5/2008(UTC)
Posts: 4
Location: Poland

Hi,

I added some delay (5s) before I started Cassini, but it's still not working. Now in event log I found:

2 warrnings:
Cassini web application [1384, "current"] was stopped but the port was not successfully released.
Cassini web application [7756, "UltiDev Cassini Web Server Explorer"] was stopped but the port was not successfully released.

then 2 infos:
Service was stopped successfully.
Service was started successfully.

and finally 2 errors (like in previous post):
Exception in Cassini web application [7756, "UltiDev Cassini Web Server Explorer"].
Exception:
System.Net.Sockets.SocketException: Tylko jedno użycie każdego adresu gniazda (protokół/adres sieciowy/port) jest normalnie dozwolone
w System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
w System.Net.Sockets.Socket.Bind(EndPoint localEP)
w Cassini.Server.Start()
w CassiniService.Service1.WebAppEntry.Start()

Exception in Cassini web application [1384, "current"].
Exception:
System.Net.Sockets.SocketException: Tylko jedno użycie każdego adresu gniazda (protokół/adres sieciowy/port) jest normalnie dozwolone
w System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
w System.Net.Sockets.Socket.Bind(EndPoint localEP)
w Cassini.Server.Start()
w CassiniService.Service1.WebAppEntry.Start()


Another bug/feature is, that Cassini service won't start when I turn on option "interact with desktop" (in service properties). The message is something like that: "service not respond for start signal".
Why?

Ultidev Team
#12 Posted : Wednesday, August 13, 2008 5:03:34 AM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Hi there!

The reason UltiDev Cassini does not start with "Allow service to interact with desktop" is because it was not designed to do that. Most likely with that setting Cassini thinks it is running as interactive program, and seeing the lack of command line parameters, just quits.

As for "Cassini web application XYZ was stopped but the port was not successfully released.", it means that even after we called socket.Close() and unloaded appdomain hosting the application, the socket still remains bound to the port for some reason. Naturally, subsequent attempt of Cassini to start listening on the port to serve the application fails because it takes some time for the port to get free. We've seen this happening mostly on really slow systems, like old low-memory notebooks, or virtual machines running on slow hosts. If you can reliably reproduce this issue on more than one system, we would really like to know more about system configurations.

Unfortunately we can't come up with the reliable work-around for the issue. We are not sure what makes ports remain tied up. We know that a couple minutes later you are pretty much guaranteed to get your ports back and can start the service again.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
Rss Feed  Atom Feed
Users browsing this topic
Guest (4)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.