Solved

ASP page running on IIS7

Posted on 2009-05-06
31
2,521 Views
Last Modified: 2012-05-06
I have a basic asp page the returns an xml content type from a sql database based on the sql statement that is passed into the page.  My dev box is running IIS6 and everything works fine.  On the production box, which is running IIS7 the page does not run.  I have attached the code.

Additionally on the production box, asp and aspx have been enabled to run on IIS 7.

I have removed some spots on code with minimal success.  I'm questioning the looping portion of the code at this time, but cannot narrow it down.  The connection object  is:

<%
Dim objConn
Dim sConn

Set objConn = Server.CreateObject("ADODB.Connection")
sConn = "DSN=" & Session.Value("DSN") & ";UID=" & Session.Value("DBUserID") & ";PWD=" & Session.Value("DBPassword")
objConn.ConnectionString = sConn
objConn.Open
%>

Any help on what when wrong would be great.  Tks.
<!-- #include file="_connObj.asp" -->
<%
On Error Resume Next
 
response.ContentType="text/xml"
response.Write("<?xml version='1.0' encoding='ISO-8859-1'?>")
 
Dim sSQL
Dim rsResult
 
sSQL = Request.QueryString("sql")
Set rsResult = Server.CreateObject("ADODB.Recordset")
rsResult.Open sSQL, objConn
 
response.write("<records>")
 
If Not rsResult.eof Then
	rsResult.MoveFirst
	do While Not rsResult.Eof
		response.write("<record>")
		
		For each item In rsResult.fields
 
			response.write("<" + item.name + ">")
			response.Write(item.value)
			response.write("</" + item.name + ">")
		
		Next
		response.write("</record>")
		rsResult.MoveNext
	Loop
End If
 
rsResult.close
objConn.close
Set rsResult = Nothing
Set ObjConn = Nothing
 
response.write("</records>")
%>

Open in new window

0
Comment
Question by:trademark16
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 14
  • 14
  • 2
  • +1
31 Comments
 
LVL 10

Expert Comment

by:ALaRiva
ID: 24319484
Are you receiving any errors?
0
 
LVL 9

Expert Comment

by:CCongdon
ID: 24319563
Have you enabled ASP pages in IIS? By default IIS7 does not server 'Classic' ASP pages.
0
 
LVL 10

Expert Comment

by:ALaRiva
ID: 24319578
Nice Catch CCongdon!

I haven't had the need to use Classic on IIS7, but that's a great thing to note.
0
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 

Author Comment

by:trademark16
ID: 24319611
I have enabled asp in IIS as i mentioned in the second paragraph of my question:

"Additionally on the production box, asp and aspx have been enabled to run on IIS 7."
0
 

Author Comment

by:trademark16
ID: 24319658
With regards to errors, i get the following on the page:
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

Only one top level element is allowed in an XML document. Error processing resource 'http://ssssql02/select.asp?sql=select%...

<record></record><record></record><record></record><record></record><reco...
 
It's as if it doe not write the <records> tag first, nor any data.  Below is that the file looks like on IIS 6:

<?xml version="1.0" encoding="ISO-8859-1" ?>
- <records>
- <record>
  <actcd>L</actcd>
  <activity>Low</activity>
  <ordinal>1</ordinal>
  </record>
- <record>
  <actcd>LM</actcd>
  <activity>Low to Moderate</activity>
  <ordinal>2</ordinal>
  </record>
- <record>
  <actcd>M</actcd>
  <activity>Moderate</activity>
  <ordinal>3</ordinal>
  </record>
- <record>
  <actcd>MH</actcd>
  <activity>Moderate to High</activity>
  <ordinal>4</ordinal>
  </record>
- <record>
  <actcd>NI</actcd>
  <activity>Not Investigated</activity>
  <ordinal>0</ordinal>
  </record>
- <record>
  <actcd>VH</actcd>
  <activity>Very High</activity>
  <ordinal>5</ordinal>
  </record>
  </records>
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24319904
Hello trademark16
Give this a shot on the system that will not run your code
http://ee.cffcs.com/Q_24386646/Q_24386646.asp
code
http://ee.cffcs.com/Q_24386646/Q_24386646.zip

If this works on both machines then there is an issue with you code running on IIS7

Good Luck
Carrzkiss
0
 

Author Comment

by:trademark16
ID: 24320013
It worked on IIS6 but i received the following error on IIS 7:

This error (HTTP 500 Internal Server Error) means that the website you are visiting had a server problem which prevented the webpage from displaying.

Do you think it is an installation issue?
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24320063
On the IIS7 machine, do you have Show Friendly URL enabled?

Internet Explorer
Tools | Internet Options | Advanced |  
[ ] Show Friendly HTTP Error Messages  (Uncheck)

Then reload the page and see what error you recieve?
0
 

Author Comment

by:trademark16
ID: 24320244
I now get:

The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

Invalid at the top level of the document. Error processing resource 'http://192.168.16.4/Q_24386646.asp'. Line 1, Position...

<?xml version="1.0" encoding="ISO-8859-1"?>An error occurred on the server when processing the URL. Please contact the...
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24320367
I found this, give it a try on the IIS7 system
(Internet Explorer)
Internet options -> Security, [Custom Levels]
"access data sources across domains". Its usually
disabled. [Enable] it. and the refresh the page.

Still doing research on it...
0
 

Author Comment

by:trademark16
ID: 24320409
Still no luck.  If it helps the browser i am using is local to the web server running on the windows 2008 server.
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24320441
Can you view the link that I have up on the IIS7 system?
http://ee.cffcs.com/Q_24386646/Q_24386646.asp
This will determin if it is the Browser.
If you can view this, then there is an Internal Issue on the system and rules out the browser.
0
 

Author Comment

by:trademark16
ID: 24320473
Yes, i can view your link just fine.
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24320545
OK.
Since you can view the external link, then your Browser is not the issue.
There is an enternal issue with IIS7.
Just found this information, maybe this will help you to get up and running with XML on your system.
http://andrew.thomas.net.nz/blog/post/2009/03/09/Setting-up-IIS-7-to-handle-sitmapxml-request-in-code.aspx

IIS7 does things a lot different then previous version's of IIS.
(I am use to IIS4 and IIS5 myself)

Let me know if the link helps.
Carrzkiss

0
 

Author Comment

by:trademark16
ID: 24320616
Unfortunately this didn't help either however, i did get a different error:

Server Error in '/' Application.
--------------------------------------------------------------------------------

The DefaultHttpHandler.BeginProcessRequest method is not supported by IIS integrated pipeline mode.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.PlatformNotSupportedException: The DefaultHttpHandler.BeginProcessRequest method is not supported by IIS integrated pipeline mode.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:


[PlatformNotSupportedException: The DefaultHttpHandler.BeginProcessRequest method is not supported by IIS integrated pipeline mode.]
   System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) +654
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +398
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +274

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3074; ASP.NET Version:2.0.50727.3074
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24321054
Not familuar with that error unfortunantly.
If you did what was on the link, then un-do-it.
So we can get back to the issue at hand, without having to troubleshoot something that was
Caused by something else.

Can you run a plain .xml file from the server?
<?xml version="1.0" encoding="ISO-8859-1"?>
<records>
<record>
<actdc>L</actdc>
<activity>Low</activity>
<ordinal>1</ordinal>
</record>
<record>
<actdc>LM</actdc>
<activity>Low to Moderate</activity>
<ordinal>2</ordinal>
</record>
<record>
<actdc>M</actdc>
<activity>Moderate</activity>
<ordinal>3</ordinal>
</record>
<record>
<actdc>MH</actdc>
<activity>Moderate to High</activity>
<ordinal>4</ordinal>
</record>
<record>
<actdc>NI</actdc>
<activity>Not Investigated</activity>
<ordinal>0</ordinal>
</record>
<record>
<actdc>VH</actdc>
<activity>Very High</activity>
<ordinal>6</ordinal>
</record>
</records>

Open in new window

0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24321114
Another link for you.
http://forums.iis.net/t/1050120.aspx
This is about the MIME File Types within IIS7.
Please have a look at the first post, and then the last post's link.

Good Luck
Carrzkiss
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24321219
Try this please.

Within IIS7 Manager.
Right click on the page and choose [Browse]
See if the page comes up?

IF it does then check to make sure that you are typing out the url page name correctly?
As in.
Example:
Name of page   =   MySite.asp
you typed out:   =   mysite.asp

I am not sure if this is your case, but just something to try.
Let me know?
Carrzkiss
0
 
LVL 31

Accepted Solution

by:
Wayne Barron earned 500 total points
ID: 24321246
this is the link that I got the last bit of information from.
Have a look at the different post that are made, there are several other people
That fixed their issues a little differently.
http://professionalaspnet.com/blogs/aspnet_blog/archive/2006/04/07/A_name_was_started_with_an_invalid_character_Error_processing_resource.aspx

This seems to be all XP, but maybe one of them will assist you in correcting your issues.

Good Luck
Carrzkiss
0
 

Author Comment

by:trademark16
ID: 24321729
I removed the handler maapings, then per the one article change the content type from text/xml to applicaiton/xml with no luck.  Verified the case on the file name, all were lower so that was also not the issue.  I also changed a config setting per the article and again with no luck.  

After that i removed teh on erro resume line of code and changes and the IIS setting "send errors to brower" to true and now i get this:

The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.

--------------------------------------------------------------------------------

A string literal was expected, but no opening quote character was found. Error processing resource 'http://ssssql02/select....

<?xml version='1.0' encoding='ISO-8859-1'?> <font face="Arial" size=2>
----------------------------------------...
 
 
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24321872
Try this.
Maybe it is picking up on some code that is not suppose to be there?
Let me know

Carrzkiss
<% Response.ContentType="application/xml" %><?xml version="1.0" encoding="ISO-8859-1"?><%
Set cnxml = Server.CreateObject("ADODB.Connection")
cnxml.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath ("Q_24386646.mdb") & ";"
cnxml.Open
sqlxml = "SELECT ID, actcd, activity, ordinal FROM Table1"
Set rsxml = Server.CreateObject("ADODB.Recordset")
rsxml.Open sqlxml, cnxml
%><records>
<%DO Until (rsxml.EOF)%>
<record>
<actdc><%=rsxml("actcd")%></actdc>
<activity><%=rsxml("activity")%></activity>
<ordinal><%=rsxml("ordinal")%></ordinal>
</record><%
rsxml.MoveNext
Loop
rsxml.close
Set rsxml = nothing
%></records>

Open in new window

0
 

Author Comment

by:trademark16
ID: 24321890
I get the same following error:

The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.

--------------------------------------------------------------------------------

A string literal was expected, but no opening quote character was found. Error processing resource 'http://ssssql02/newtest...

<?xml version="1.0" encoding="ISO-8859-1"?> <font face="Arial" size=2>
----------------------------------------...

Which the more i read people claim the error is at size=2 should be size="2", which is a default somewhere when IIS spits out the error.  Not helpful to us.
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24321937
try this one.
Carrzkiss
<% Response.ContentType="application/xml" %><?xml version="1.0" encoding="ISO-8859-1"?><%
Set cnxml = Server.CreateObject("ADODB.Connection")
cnxml.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath ("Q_24386646.mdb") & ";"
cnxml.Open
sqlxml = "SELECT ID, actcd, activity, ordinal FROM Table1"
Set rsxml = Server.CreateObject("ADODB.Recordset")
rsxml.Open sqlxml, cnxml
%><records>
<%DO Until (rsxml.EOF)%>
<record>
<actdc><%=rsxml("actcd")%></actdc>
<activity><%=rsxml("activity")%></activity>
<ordinal><%=Clng(rsxml("ordinal"))%></ordinal>
</record><%
rsxml.MoveNext
Loop
rsxml.close
Set rsxml = nothing
%></records>

Open in new window

0
 

Author Comment

by:trademark16
ID: 24321960
Same error.  What was the difference in the two files?  I must have missed it.
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24321976
first file
<ordinal><%=rsxml("ordinal")%></ordinal>

2nd file
<ordinal><%=Clng(rsxml("ordinal"))%></ordinal>

I am running out of idea's?

0
 

Author Comment

by:trademark16
ID: 24321990
Same here.  I was trying the recordset with a command object instead with no luck.  I went that direction becasue when i comment out the line of code:

rsResult.Open sSQL, objConn

I then get an XML file.  With no data of course, but the xml file is a least produced.
0
 

Author Comment

by:trademark16
ID: 24322062
Removed everything related to xml and just tried to produce an html page with the following code and this failed as well on IIS7, but worked on IIS6:

<!-- #include file="_connObj.asp" -->
<%
On Error Resume Next

response.ContentType="text/html"

Dim sSQL, sWhere
Dim rsResult

sSQL = Request.QueryString("sql")
Set rsResult = Server.CreateObject("ADODB.Recordset")
rsResult.Open sSQL, objConn

If Not rsResult.eof Then
      rsResult.MoveFirst
      do While Not rsResult.Eof
            For each item In rsResult.fields
                  response.write(item.name + "<br>")
                  response.Write(item.value + "<br>")
            Next
            rsResult.MoveNext
      Loop
End If

rsResult.close
objConn.close
Set rsResult = Nothing
Set ObjConn = Nothing
%>
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24322150
can you create a page and call it
Add this line to it.

<%response.write("Hello World")%>

Name the page    hello.asp

Run the script...
http://localhost/hello.asp

And let me know what you see?
0
 

Author Comment

by:trademark16
ID: 24324945
I see Hello World.
0
 

Author Comment

by:trademark16
ID: 24329222
Going to rewrite in ASP.net.

Thanks for all your help.
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24329457
Good luck with the new coding.

Carrzkiss
0

Featured Post

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Running classic asp applications under Windows Server 2008 R2 (x64) and IIS 7 is not as easy as one may think. It took me a while to figure it out while getting error 8002801d a few times. After you install the OS you will need to install the fol…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question