problem with tcp port
alucas at srtec.com
alucas at srtec.com
Wed Apr 26 19:13:05 EDT 2006
Hello,
I've a problem. I'm writting a sample desktop c# application that render a
map located in a server. All works fine, but when I call renderMap method,
I get a error with the port for connection 2801 in the server and the
MapGuideServer service in the server machine crash.
Sample code:(Sorry for long lines of code, I'm wrtting from web mail)
...
// Init Winsock
MapGuideApi.InitializeSockets();
// Init WebTier
MapGuideApi.MgInitializeWebTier(@"C:\Program
Files\MapGuideOpenSource\WebServerExtensions\www\webconfig.ini");
// Connect to the site server
MgSiteConnection siteConn = new MgSiteConnection();
MgUserInformation userInfo = new MgUserInformation("Administrator","admin");
siteConn.Open(userInfo);
// create an instance of resource service
MgResourceService
resourceService=siteConn.CreateService(MgServiceType.ResourceService)as
MgResourceService;
MgRenderingService renderService =
siteConn.CreateService(MgServiceType.RenderingService) as
MgRenderingService;
MgResourceIdentifier resourceMap = new
MgResourceIdentifier("Library://Samples/test/Map/Map.MapDefinition");
// Create a new map instance
MgMap map = new MgMap();
map.Create(resourceService, resourceMap, "Map");
// Render the map (for test to show map features, it works fine)
//MgEnvelope ext = map.GetMapExtent();
//MgCoordinate ll = ext.GetLowerLeftCoordinate();
//MgCoordinate ur = ext.GetUpperRightCoordinate();
//string bgcolor = map.GetBackgroundColor();
// MessageBox.Show(bgcolor); // works fine
// problem writting protected memory!!!
MgByteReader rdr = renderService.RenderMap(map, null, "png");
...
Future steps when I've solved this problem:
//MgByteSink bs = new MgByteSink(rdr);
//bs.ToFile("demo.png");
...
In the server side, I went to logs dir. and open Errors file and this is
the error reported:
<2006-04-25T21:43:25>
Error: Port 2801 is not available, please try using a different port.
Exception occurred in method MgServer.svc at line 1001 in file
c:\build_tux_area\mgdev\server\src\core\Server.cpp
I've tested the port in the server with a sample tcp program that connects
to server:2801 and the server and port are ok. The client application show
a error writting in protected memory...
In my webconfig, I think that all is ok, this config file is in my client
machine (where c# app runs). So, I suspect that port 2801 is for
connections from server side applications. I suspect this, because reading
the webconfig file, in the statement 'client connection' only the port is
specified, but in 'site connections' exists IP and port. I'm not sure of
this.
Any idea?
Thanks in advance.
Antonio Lucas
Software Engineer
SER&TEC S.L
Phone: +34 96 395 95 13
www.srtec.com
Valencia (Spain)
More information about the Mapguide_dev
mailing list