• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2580
  • Last Modified:

ASP page running on IIS7

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
trademark16
Asked:
trademark16
  • 14
  • 14
  • 2
  • +1
1 Solution
 
ALaRivaCommented:
Are you receiving any errors?
0
 
CCongdonCommented:
Have you enabled ASP pages in IIS? By default IIS7 does not server 'Classic' ASP pages.
0
 
ALaRivaCommented:
Nice Catch CCongdon!

I haven't had the need to use Classic on IIS7, but that's a great thing to note.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
trademark16Author Commented:
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
 
trademark16Author Commented:
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
 
Wayne BarronAuthor, Web DeveloperCommented:
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
 
trademark16Author Commented:
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
 
Wayne BarronAuthor, Web DeveloperCommented:
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
 
trademark16Author Commented:
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
 
Wayne BarronAuthor, Web DeveloperCommented:
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
 
trademark16Author Commented:
Still no luck.  If it helps the browser i am using is local to the web server running on the windows 2008 server.
0
 
Wayne BarronAuthor, Web DeveloperCommented:
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
 
trademark16Author Commented:
Yes, i can view your link just fine.
0
 
Wayne BarronAuthor, Web DeveloperCommented:
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
 
trademark16Author Commented:
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
 
Wayne BarronAuthor, Web DeveloperCommented:
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
 
Wayne BarronAuthor, Web DeveloperCommented:
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
 
Wayne BarronAuthor, Web DeveloperCommented:
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
 
Wayne BarronAuthor, Web DeveloperCommented:
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
 
trademark16Author Commented:
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
 
Wayne BarronAuthor, Web DeveloperCommented:
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
 
trademark16Author Commented:
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
 
Wayne BarronAuthor, Web DeveloperCommented:
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
 
trademark16Author Commented:
Same error.  What was the difference in the two files?  I must have missed it.
0
 
Wayne BarronAuthor, Web DeveloperCommented:
first file
<ordinal><%=rsxml("ordinal")%></ordinal>

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

I am running out of idea's?

0
 
trademark16Author Commented:
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
 
trademark16Author Commented:
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
 
Wayne BarronAuthor, Web DeveloperCommented:
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
 
trademark16Author Commented:
I see Hello World.
0
 
trademark16Author Commented:
Going to rewrite in ASP.net.

Thanks for all your help.
0
 
Wayne BarronAuthor, Web DeveloperCommented:
Good luck with the new coding.

Carrzkiss
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

  • 14
  • 14
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now