“StartTag: invalid element name” in default.aspx

(Warning – asp newbie) I have an aspx file with the tag

    <%@ Page Language=VB  ... %>

right at the beginning of the file.

When calling this from my IIS server (http://localhost/myservice/default.aspx), this gives me the error

This page contains the following
errors:

error on line 1 at column 2:
StartTag: invalid element name
Below is a rendering of the page up to
the first error.

What am I doing wrong?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

It appears as if the browser tries to display what it thinks is an XML file, since it gives an error on the second character of the first line. So I think the file is not parsed, but simply returned as is immediately. Check if your IIS server is configured correctly and that it actually parses your ASP tags before returning the page.

Method 2

When I went into the ASP.NET tab for the virtual directory I noticed the ASP.NET version was not selected (it was an empty combo box). Choosing the .NET framework version did the trick. Thanks.

Method 3

Similar to the previous comment, in my setup too the ASP.NET version was not selected. But after selecting the version i got the following error while accessing the aspx file.
Windows XP, IIS 5.1.
Exception Details: System.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase.

Executed the following commands, aspnet_iis -i
and aspnet_iis -ga

resolved the issue.

Method 4

When i did this. It worked fine.

Go to this directroy in command prompt C:WINDOWSMicrosoft.NETFrameworkv2.0.50727
Run this command
Aspnet_regiis -I

this will install aspnet

Method 5

For me, the problem was that I was viewing the .svc file using my local file path mapped to a server in my browser when I meant to be using the verbatim path to my server.

Method 6

Try this :

To install and enable ASP.NET:

Click Start, and then click Control Panel.
Click Add or Remove Programs.
Click Add/Remove Windows components.
Double-click Application Server, and then click Details.
Click to select the ASP.NET check box, and then click OK.
Click Next.
Click Finish.

Method 7

For me, the problem was in the serialization that responded to client.

My problem was in the xml tags spaces:

  - < tag > text < / tag >  ---> wrong

  - <tag> text </tag> ----> good.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x