[pycsw-devel] Running on Windows 2008 Server IIS7

Tom Kralidis tomkralidis at hotmail.com
Thu Mar 15 20:55:20 EDT 2012



Bruce: thanks for the info.  Looks like the XML in the response is mangled.  I wonder if there's an IIS7 compression issue (http://stackoverflow.com/questions/702124/enable-iis7-gzip)?  pycsw uses gzip compression when requested by the client headers.

As a test, can you change the file server/server.py, line 172 (https://sourceforge.net/apps/trac/pycsw/browser/tags/1.0.0/server/server.py#L172) from:

            self.gzip = True

to

            self.gzip = False

This forces any compression to be OFF in the response.

Does this work for you?  If yes, then I'm guessing IIS7 needs to be configured to support gzip compression.

Thanks again for your valuable testing and feedback.

..Tom


> Subject: RE: [pycsw-devel] Running on Windows 2008 Server IIS7
> Date: Wed, 14 Mar 2012 22:54:17 -0700
> From: bgodfrey at uidaho.edu
> To: tomkralidis at hotmail.com; gcpp.kalxas at gmail.com
> CC: pycsw-devel at lists.sourceforge.net
> 
> Yep, that was it.  Thank you very much for solving that one.
> 
> It seems I have another issue.  With tester http://dev.insideidaho.org/pycsw/tester/ I can get a GetCapabilities response only if in default.cfg "xml_pretty_print=false".  If I change that to ""xml_pretty_print=true" I don't get anything in the response text box.  
> 
> If I try to go to:
> http://dev.insideidaho.org/pycsw/csw.py?service=CSW&version=2.0.2&request=GetCapabilities
> 
> I get this with "xml_pretty_print=false":
> This page contains the following errors:
> error on line 3 at column 27: xmlns:dc: 'http://purl.org/dc/elepabilities xments/1.1/' is not a valid URI
> Below is a rendering of the page up to the first error.
> 
> I get this with "xml_pretty_print=true":
> This webpage is not available
> The webpage at http://dev.insideidaho.org/pycsw/csw.py?service=CSW&version=2.0.2&request=GetCapabilities might be temporarily down or it may have moved permanently to a new web address.
> Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error.
> 
> Is there something in default.cfg that I might have incorrect?  
> 
> Thank you for your patience working through this with me.
> 
> -Bruce
> 
> 
> -----Original Message-----
> From: Tom Kralidis [mailto:tomkralidis at hotmail.com] 
> Sent: Wednesday, March 14, 2012 3:58 PM
> To: Godfrey, Bruce; gcpp.kalxas at gmail.com
> Cc: pycsw-devel at lists.sourceforge.net
> Subject: RE: [pycsw-devel] Running on Windows 2008 Server IIS7
> 
> 
> 
> Bruce: thanks for the info.  Any chance that there are multiple Python installs?  You have sqlalchemy from the command line, but is it the same Python being used by IIS?  Where is sqlalchemy installed?  Perhaps you can set the PYTHONPATH environment variable to this directory?
> 
> ..Tom
> 
> 
> 
> Subject: RE: [pycsw-devel] Running on Windows 2008 Server IIS7
> Date: Wed, 14 Mar 2012 14:22:05 -0700
> From: bgodfrey at uidaho.edu
> To: tomkralidis at hotmail.com; gcpp.kalxas at gmail.com
> CC: pycsw-devel at lists.sourceforge.net
> 
> 
> 
> 
> .ExternalClass p.ecxMsoNormal, .ExternalClass li.ecxMsoNormal, .ExternalClass div.ecxMsoNormal
> {margin-bottom:.0001pt;font-size:12.0pt;font-family:"Times New Roman","serif";}
> .ExternalClass h2
> {margin-bottom:.0001pt;font-size:20.5pt;font-family:"Times New Roman","serif";color:#CC0000;font-weight:bold;}
> .ExternalClass h3
> {margin-right:0in;margin-bottom:0in;margin-left:0in;margin-bottom:.0001pt;font-size:17.0pt;font-family:"Times New Roman","serif";color:#CC0000;font-weight:bold;}
> .ExternalClass a:link, .ExternalClass span.ecxMsoHyperlink
> {color:blue;text-decoration:underline;}
> .ExternalClass a:visited, .ExternalClass span.ecxMsoHyperlinkFollowed
> {color:purple;text-decoration:underline;}
> .ExternalClass p
> {margin-right:0in;margin-left:0in;font-size:12.0pt;font-family:"Times New Roman","serif";}
> .ExternalClass pre
> {margin-bottom:.0001pt;font-size:10.0pt;font-family:"Courier New";}
> .ExternalClass span.ecxHTMLPreformattedChar
> {font-family:Consolas;}
> .ExternalClass span.ecxEmailStyle20
> {font-family:"Calibri","sans-serif";color:#1F497D;}
> .ExternalClass span.ecxHeading2Char
> {color:#CC0000;font-weight:bold;}
> .ExternalClass span.ecxHeading3Char
> {color:#CC0000;font-weight:bold;}
> .ExternalClass .ecxMsoChpDefault
> {font-size:10.0pt;}
> @page WordSection1
> {size:8.5in 11.0in;}
> .ExternalClass div.ecxWordSection1
> {page:WordSection1;}
> 
> Here is the error returned from your script: HTTP Error 502.2 - Bad GatewayThe specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are "Traceback (most recent call last): File "C:\criticalApplications\console\pycsw\pycsw-1.0.0\test3.py", line 4, in <module> import sqlalchemy ImportError: No module named sqlalchemy ". But, in a python shell if I request the version I get '0.7.5' though as shown here: Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32Type "copyright", "credits" or "license()" for more information.>>> import sqlalchemy>>> sqlalchemy.__version__'0.7.5'>>>  And, I see "sqlalchemy' show up in the list when I use "help('modules')". Ideas on how best to proceed? -Bruce  From: Tom Kralidis [mailto:tomkralidis at hotmail.com] 
> Sent: Wednesday, March 14, 2012 1:32 PM
> To: Godfrey, Bruce; gcpp.kalxas at gmail.com
> Cc: pycsw-devel at lists.sourceforge.net
> Subject: RE: [pycsw-devel] Running on Windows 2008 Server IIS7  
> Bruce: thanks for the info.  I'm wondering about the sqlalchemy issue, and the fact that it's not found is causing an error right away.  Can you try, as a cgi script:
>  
> #!/Python27/python -u
>  
> import os
> import sqlalchemy
>  
> print 'Content-type:text/plain\n\n'
>  
> for k,v in os.environ.iteritems():
>     print '%s -> %s' %(k,v)
>  
> This should run fine assuming sqlalchemy can be found in your environment in IIS, and we can see what environment variables IIS is working with at runtime.
>  
> I don't have an IIS environment, so if you can try, that would be great.  We can then figure out a way to patch the IIS environment variables in the codebase.
>  
> Thanks
>  
> ..Tom
>  
>  
> Date: Wed, 14 Mar 2012 12:47:35 -0700
> From: bgodfrey at uidaho.edu
> To: gcpp.kalxas at gmail.com
> CC: pycsw-devel at lists.sourceforge.net
> Subject: Re: [pycsw-devel] Running on Windows 2008 Server IIS7
>  
>  
>  
>  
> .ExternalClass p.ecxMsoNormal, .ExternalClass li.ecxMsoNormal, .ExternalClass div.ecxMsoNormal
> {margin-bottom:.0001pt;font-size:11.0pt;font-family:"Calibri","sans-serif";color:black;}
> .ExternalClass a:link, .ExternalClass span.ecxMsoHyperlink
> {color:blue;text-decoration:underline;}
> .ExternalClass a:visited, .ExternalClass span.ecxMsoHyperlinkFollowed
> {color:purple;text-decoration:underline;}
> .ExternalClass pre
> {margin-bottom:.0001pt;font-size:10.0pt;font-family:"Courier New";color:black;}
> .ExternalClass span.ecxHTMLPreformattedChar
> {font-family:Consolas;color:black;}
> .ExternalClass span.ecxEmailStyle19
> {font-family:"Calibri","sans-serif";color:windowtext;}
> .ExternalClass span.ecxEmailStyle20
> {font-family:"Calibri","sans-serif";color:#1F497D;}
> .ExternalClass span.ecxEmailStyle21
> {font-family:"Calibri","sans-serif";color:#1F497D;}
> .ExternalClass .ecxMsoChpDefault
> {font-size:10.0pt;}
> @page WordSection1
> {size:8.5in 11.0in;}
> .ExternalClass div.ecxWordSection1
> {page:WordSection1;}
>  
>  I added system added environment variable for 'HTTP_HOST' and 'REQUEST_URI'.  That appears to have gotten me further along.  But, I have another hurdle to clear it appears.  See below. I've got simple test python scripts working in the same web directory as cws.py.  They can be seen here:http://dev.insideidaho.org/pycsw/test.py and http://dev.insideidaho.org/pycsw/test2.py.  So, I think (fingers crossed) that I have the web server configured correctly but maybe I am overlooking something. When I use the pycsw tester to try make a GetCapabilities request I get a 502 error.   Pycsw tester is here: http://dev.insideidaho.org/pycsw/tester/index.html When I run pycsw on the localhost machine I get this response with more details: #############################BEGIN RESPONSE################################# <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>IIS 7.0 Detailed Error - 502.2 - Bad Gateway</title> <style type="text/css"> <!-- body{margin:0;font-size:.7em;font-family:Verdana,Arial,Helvetica,sans-serif;background:#CBE1EF;} code{margin:0;color:#006600;font-size:1.1em;font-weight:bold;} .config_source code{font-size:.8em;color:#000000;} pre{margin:0;font-size:1.4em;word-wrap:break-word;} ul,ol{margin:10px 0 10px 40px;} ul.first,ol.first{margin-top:5px;} fieldset{padding:0 15px 10px 15px;} .summary-container fieldset{padding-bottom:5px;margin-top:4px;} legend.no-expand-all{padding:2px 15px 4px 10px;margin:0 0 0 -12px;} legend{color:#333333;padding:4px 15px 4px 10px;margin:4px 0 8px -12px;_margin-top:0px;  border-top:1px solid #EDEDED;border-left:1px solid #EDEDED;border-right:1px solid #969696;  border-bottom:1px solid #969696;background:#E7ECF0;font-weight:bold;font-size:1em;} a:link,a:visited{color:#007EFF;font-weight:bold;} a:hover{text-decoration:none;} h1{font-size:2.4em;margin:0;color:#FFF;} h2{font-size:1.7em;margin:0;color:#CC0000;} h3{font-size:1.4em;margin:10px 0 0 0;color:#CC0000;} h4{font-size:1.2em;margin:10px 0 5px 0; }#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS",Verdana,sans-serif;  color:#FFF;background-color:#5C87B2; }#content{margin:0 0 0 2%;position:relative;} .summary-container,.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;} .config_source{background:#fff5c4;} .content-container p{margin:0 0 10px 0; }#details-left{width:35%;float:left;margin-right:2%; }#details-right{width:63%;float:left; }#server_version{width:96%;_height:1px;min-height:1px;margin:0 0 5px 0;padding:11px 2% 8px 2%;color:#FFFFFF;  background-color:#5A7FA5;border-bottom:1px solid #C1CFDD;border-top:1px solid #4A6C8E;font-weight:normal;  font-size:1em;color:#FFF;text-align:right; }#server_version p{margin:5px 0;} table{margin:4px 0 4px 0;width:100%;border:none;} td,th{vertical-align:top;padding:3px 0;text-align:left;font-weight:bold;border:none;} th{width:30%;text-align:right;padding-right:2%;font-weight:normal;} thead th{background-color:#ebebeb;width:25%; }#details-right th{width:20%;} table tr.alt td,table tr.alt th{background-color:#ebebeb;} .highlight-code{color:#CC0000;font-weight:bold;font-style:italic;} .clear{clear:both;} .preferred{padding:0 5px 2px 5px;font-weight:normal;background:#006633;color:#FFF;font-size:.8em;} --> </style>  </head> <body> <div id="header"><h1>Server Error in Application "DEFAULT WEB SITE/PYCSW"</h1></div> <div id="server_version">Internet Information Services 7.0<BR></div> <div id="content"> <div class="content-container">  <fieldset><legend>Error Summary</legend>   <h2>HTTP Error 502.2 - Bad Gateway</h2>   <h3>The specified CGI application misbehaved by not returning a complete set of HTTP headers.  The headers it did return are &quot;Traceback (most recent call last):  File &quot;C:\criticalApplications\console\pycsw\pycsw-1.0.0\csw.py&quot;, line 34, in &lt;module&gt;    from server import server  File &quot;C:\criticalApplications\console\pycsw\pycsw-1.0.0\server\server.py&quot;, line 40, in &lt;module&gt;    import config, fes, log, profile, repository, util  File &quot;C:\criticalApplications\console\pycsw\pycsw-1.0.0\server\repository.py&quot;, line 33, in &lt;module&gt;    from sqlalchemy import create_engine, desc, funcImportError: No module named sqlalchemy&quot;.</h3>  </fieldset> </div> <div class="content-container">  <fieldset><legend>Detailed Error Information</legend>   <div id="details-left">    <table border="0" cellpadding="0" cellspacing="0">     <tr class="alt"><th>Module</th><td>CgiModule</td></tr>     <tr><th>Notification</th><td>ExecuteRequestHandler</td></tr>     <tr class="alt"><th>Handler</th><td>Python</td></tr>     <tr><th>Error Code</th><td>0x00000001</td></tr>         </table>   </div>   <div id="details-right">    <table border="0" cellpadding="0" cellspacing="0">     <tr class="alt"><th>Requested URL</th><td>http://dev.insideidaho.org:80/pycsw/csw.py</td></tr>     <tr><th>Physical Path</th><td>C:\criticalApplications\console\pycsw\pycsw-1.0.0\csw.py</td></tr>     <tr class="alt"><th>Logon Method</th><td>Anonymous</td></tr>     <tr><th>Logon User</th><td>Anonymous</td></tr>         </table>    <div class="clear"></div>   </div>  </fieldset> </div> <div class="content-container">  <fieldset><legend>Most likely causes:</legend>   <ul>     <li>The CGI process was shut down or terminated unexpectedly before it finished processing the request.</li>                 <li>The CGI process has a flaw and does not return a complete set of HTTP headers.</li> </ul>  </fieldset> </div> <div class="content-container">  <fieldset><legend>Things you can try:</legend>   <ul>     <li>Check the event logs on the system to see whether the CGI process is shutting down unexpectedly.</li>                 <li>Troubleshoot the CGI application to determine why it is not sending a complete set of HTTP headers.</li> </ul>  </fieldset> </div>   <div class="content-container">  <fieldset><legend>Links and More Information</legend>   This error occurs when the CGI process handling the request exits before it finishes sending the response to IIS.   <a href="http://go.microsoft.com/fwlink/?LinkID=62293&amp;IIS70Error=502,2,0x00000001,6002">View more information &raquo;</a><BR>     </fieldset> </div> </div> </body> </html> #############################END RESPONSE#################################  Note that "sqlalchemy' show up in the list when I use "help('modules')"  It seems like the crux of the issue is that IIS7 doesn't like the way the HTTP headers being returned by the pycsw script(s).  Maybe a syntax issue?  I'm not sure.  I'm definitely no expert.  Since I can run the test.py scripts I'm hoping that the web server is configured properly.  If not I'm not quite sure where to look at this point.  But, maybe it is still an IIS7 configuration issue. Ideas on how to troubleshoot this or get it working?  Thanks much! -Bruce  From: Angelos Tzotsos [mailto:gcpp.kalxas at gmail.com] 
> Sent: Tuesday, March 13, 2012 6:08 PM
> To: Godfrey, Bruce
> Cc: pycsw-devel at lists.sourceforge.net
> Subject: Re: [pycsw-devel] Running on Windows 2008 Server IIS7 Hi Bruce,
>  
> Yes, it seems that this issue is Windows specific. The "HTTP_HOST" variable is not set in the environment variables.
>  
> Please try this from a Python console:
>  
> import os
> os.environ
>  
> and send the output.
>  
> Thanks,
> Angelos
>  
> On 03/14/2012 01:29 AM, Godfrey, Bruce wrote: Hi Angelos, Yes, thank you, I was able to get it working using the syntax C:\\www\\pycsw I've run into this issue now: Traceback (most recent call last):  File "C:\criticalApplications\console\pycsw\pycsw-1.0.0\csw.py", line 40, in <module>    CSW.dispatch()  File "C:\criticalApplications\console\pycsw\pycsw-1.0.0\server\server.py", line 161, in dispatch    (os.environ['HTTP_HOST'], os.environ['REQUEST_URI'])  File "C:\Python27\lib\os.py", line 423, in __getitem__    return self.data[key.upper()]KeyError: 'HTTP_HOST'>>>  I think I'm close but I'm not sure where to look to try to track this down.  I wonder if it is an IIS7 issue? -Bruce From: Angelos Tzotsos [mailto:gcpp.kalxas at gmail.com] 
> Sent: Tuesday, March 13, 2012 4:22 PM
> To: pycsw-devel at lists.sourceforge.net
> Subject: Re: [pycsw-devel] Running on Windows 2008 Server IIS7 Hello Bruce,
>  
> Did you try the windows path like c:\path\to\pycsw ?
>  
> Regards,
> Angelos
>  
> On 03/13/2012 04:44 AM, Godfrey, Bruce wrote: Hello, I'm attempting to get pycsw running on a Windows 2008 box with IIS7.  I have all the supporting libraries installed and I have SQLite3.  I'll preface this by saying I have pretty limited experience with python.   I've changed the first line of csw.py to: #!/Python27/python -u At this point I need edit default.cfg, correct? What is the correct syntax for:  home=/var/www/pycsw on Windows?  Is it like: c:\path\to\defaul.cfg? Thank you for any assistance in getting this running on my Windows box.  I really appreciate it.   -Bruce  
>  
>  
>  
> ------------------------------------------------------------------------------Keep Your Developer Skills Current with LearnDevNow!The most comprehensive online learning library for Microsoft developersis just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,Metro Style Apps, more. Free future releases when you subscribe now!http://p.sf.net/sfu/learndevnow-d2d
>  
>  
>  
> _______________________________________________pycsw-devel mailing listpycsw-devel at lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/pycsw-devel
>  
>  
>  
> -- Angelos TzotsosRemote Sensing LaboratoryNational Technical University of Athenshttp://users.ntua.gr/tzotsos
>  
>  
> -- Angelos TzotsosRemote Sensing LaboratoryNational Technical University of Athenshttp://users.ntua.gr/tzotsos
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing 
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> pycsw-devel mailing list
> pycsw-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pycsw-devel 		 	   		  
 		 	   		  



More information about the Pycsw-devel mailing list