tags:

views:

2403

answers:

2

I'm working on an ASP .NET 2.0 site which uses a Web Application project file, and therefore compiles to a dll rather than deploying the source code as you do with the older style Web Site projects.

The site works fine on my test server (Windows Server 2003 R2, IIS6) when it runs in the root of a website. However I need to run it under a virtual directory instead. When I switch over to that, I get the following error on browsing to any of the pages in the site

CS1519: Invalid token ',' in class, struct, or interface member declaration

The error message goes onto tell me the line number and code file, however the code file is under the Temporary ASP .NET files folder and when I try to find it, it's not there.

As such I'm unable to work out which page is causing the issue although I suspect it could be the master page, if this error occurs on all pages. Has anyone else seen this before or found a solution?

A: 

It sounds like you haven't set the virtual as an application in IIS, or it is running the wrong version of ASP.NET (i.e. 1.1, when it should be 2.0.blah).

The virtual should have the cog icon in the IIS view, and in the properties pane, must have an application name.

Marc Gravell
+1  A: 

Turns out the problem was related to inheriting the config settings of the site above mine in the virtual hierarchy.

That site uses a custom profile whose properties are defined under system.web, profile, properties in the config file. The type of one of the properties was specified in the "Namespace.ClassName, AssemblyName" format.

When I removed the ", AssemblyName" from the end, the issue resolved itself, because I'd got rid of the comma that was the invalid token.

I can only assume that, when ASP .NET compiles pages at runtime, it must have been compiling the profile class too, and using the property definitions in the config file during the code generation.

gilles27