Help interpreting error?

B

brett

I have an ASP.NET 2.0 web application that runs fine on my local
machine. However, once I upload it, I get this error:

Parser Error
Description: An error occurred during the parsing of a resource
required to service this request. Please review the following specific
parse error details and modify your source file appropriately.

Parser Error Message: The file '/index.ascx.cs' does not exist.

Source Error:

Line 1: <%@ Control Language="c#" Inherits="mysite.IndexContent"
CodeFile="index.ascx.cs" %>

Source File: /index.ascx Line: 1

The DLL is in the remote server's bin folder. All of the ASPX and ASCX
files are there as well. Any ideas?

Thanks,
Brett
 
L

Laurent Bugnion

Hi,
I have an ASP.NET 2.0 web application that runs fine on my local
machine. However, once I upload it, I get this error:

Parser Error
Description: An error occurred during the parsing of a resource
required to service this request. Please review the following specific
parse error details and modify your source file appropriately.

Parser Error Message: The file '/index.ascx.cs' does not exist.

Source Error:

Line 1: <%@ Control Language="c#" Inherits="mysite.IndexContent"
CodeFile="index.ascx.cs" %>

Source File: /index.ascx Line: 1

The DLL is in the remote server's bin folder. All of the ASPX and ASCX
files are there as well. Any ideas?

Thanks,
Brett

You are mixing two models. On one hand, you can publish CS files to your
server, and the classes will be compiled on demand. On the other hand,
you can publish one or more DLL.

In the first case, you refer to the CS file using the CodeFile attribute.

However, in the second case, you must refer to the file without the
"CodeFile" attribute, but using the "Inherits" attribute only. In that
case, the assembly gets looked for in the "bin" directory. You can also
specifiy the assembly name if you know it, using this syntax:

inherits="ControlName, AssemblyName"

Normally, when you use the "web site" model and "publish" it, the
references in the ASCX and ASPX files are automatically updated to the
second way.

HTH,
Laurent
 
B

brett

Thanks. That fixed the first problem. But when I upload contents from
the local Published folder, I get this:

I found out the problem was that I wasn't published the site. I've
created a local published folder and published there. Then I uploaded
to the remote server. Now I get this error:

Parser Error
Description: An error occurred during the parsing of a resource
required to service this request. Please review the following specific
parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'mysite.Global'.
Source Error:
Line 1: <%@ Application Inherits="mysite.Global" Language="C#" %>
Source File: /global.asax Line: 1

I then created a virtual directory on the local Published folder. When
I access it via http, I get this:

Parser Error
Description: An error occurred during the parsing of a resource
required to service this request. Please review the following specific
parse error details and modify your source file appropriately.

Parser Error Message: The file '/Published/index.ascx.cs' does not
exist.
Source Error:
Line 1: <%@ Control Language="c#" Inherits="mysite.IndexContent"
CodeFile="index.ascx.cs" %>
Source File: /Published/index.ascx Line: 1


Should it not be looking for CS files after being published?

Thanks,
Brett
 
B

brett

I followed your suggestion and changed the aspx files to use
inherits="ControlName, AssemblyName". Apparently the publishing
doesn't change it.

I still have the issue with the Global.asax file.

Thanks,
Brett
 
L

Laurent Bugnion

Hi,
Thanks. That fixed the first problem. But when I upload contents from
the local Published folder, I get this:

I found out the problem was that I wasn't published the site. I've
created a local published folder and published there. Then I uploaded
to the remote server.

How do you compile / publish your website? Do you use the web
application project?

Greetings,
Laurent
 
B

brett

brett said:
I followed your suggestion and changed the aspx files to use
inherits="ControlName, AssemblyName". Apparently the publishing
doesn't change it.

I still have the issue with the Global.asax file.

Drat! I never could get the Global.asax file to open in the VS.NET
editor. I opened it in Notepad and changed the top line to use

inherits="ControlName, AssemblyName"

That fixed it. Everything seems fine. Do you know why the Publishing
didn't change the inherits part?

Thanks,
Brett
 
L

Laurent Bugnion

Hi,
Drat! I never could get the Global.asax file to open in the VS.NET
editor. I opened it in Notepad and changed the top line to use

inherits="ControlName, AssemblyName"

That fixed it. Everything seems fine. Do you know why the Publishing
didn't change the inherits part?

Thanks,
Brett

No, I don't. Try to create a small website and to publish it to test.

Also, the "publish" option changes it if you choose the "new website"
option only. If you use thw web application project, it doesn't. Are you
mixing both concepts?

Greetings,
Laurent
 
B

brett

I have an ASP.NET application project. I right click on the project
and choose Publish. I have chosen the "Target location" as the local
file system and http but that didn't matter for my issue. I have these
options selected:

- Replace matching files with local copies
- Only files needed to run this application

I then click Publish. It publishes into a sub folder of my current
project. That sub folder is a virtual directory so I can test it via
http. I then FTP the contents of the sub folder onto my remote server.

Does that help?

Thanks,
Brett
 
L

Laurent Bugnion

Hi,
I have an ASP.NET application project. I right click on the project
and choose Publish. I have chosen the "Target location" as the local
file system and http but that didn't matter for my issue. I have these
options selected:

If you mean the web application project (WAP) described here
http://webproject.scottgu.com/
then I think you have a problem, or maybe you made a mistake when you
created the control.

When you add a User Control in the WAP, the Control directive on top of
the page doesn't carry the CodeFile attribute. Could it be that

- You added that attribute yourself
- You included an existing ASCX file from another project in the current one
- You converted an ASP.NET 2 website to the WAP?

That would explain why the CodeFile attribute is found. That also
explains why the attribute remains when you publish it, because in the
WAP, the ASCX and ASPX files are left as is.

If you leave the CodeFile attribute in the directive, but the file
doesn't exist, you can compile the code, but you will have a runtime
error when the page is loaded the first time.

HTH,
Laurent
 
B

brett

When I created the project, I selected ASP.NET Web Application. I
don't think this is a WAP. I did add some of the ASCX controls from a
1.1 Framework project. But then I also added ASCX controls new into
this 2.0 project. For both, the CodeFile attribute was there. Guess
I'll just need to make sure I always change that.

I do have an option to convert this project to a Web Application.

Thanks,
Brett
 
L

Laurent Bugnion

Hi,
When I created the project, I selected ASP.NET Web Application.

Yes, it is. The ASP.NET Web Application option appears in the "New
project" dialog only if the WAP is installed.

If you don't have it, the only way to create a new website is to *not*
use the "New project" dialog, but to use the "New website" dialog.
I
don't think this is a WAP. I did add some of the ASCX controls from a
1.1 Framework project. But then I also added ASCX controls new into
this 2.0 project. For both, the CodeFile attribute was there. Guess
I'll just need to make sure I always change that.

Yes. I tested on my VS2005, creating new projects and adding new pages
and user controls. The CodeFile attribute was never included (in the
WAP). It might be an option somewhere, though I doubt it.
I do have an option to convert this project to a Web Application.

Thanks,
Brett

Where do you have this option?

Greetings,
Laurent
 
B

brett

Where do you have this option?

When I right click the project in Solution Explorer.

Brett
 
L

Laurent Bugnion

Hi,
When I right click the project in Solution Explorer.

Brett

Interesting. I don't have that option. I wonder why our installations
differ this way.

Anyway. Observe the CodeFile attribute and you should be fine. Bottom
line is: It must be set only if the source file is actually available,
and not compiled in a DLL.

Greetings,
Laurent
 
B

brett

Anyway. Observe the CodeFile attribute and you should be fine. Bottom
line is: It must be set only if the source file is actually available,
and not compiled in a DLL.

Ok, not such a big deal.

It may not matter but I didn't have an "ASP.NET Web Application"
project icon in VS.NET 2005. I had to download two updates before it
appeared:

http://www.microsoft.com/downloads/...00-9554-4733-8725-3CA89DD9BFCA&displaylang=en

and

http://msdn2.microsoft.com/en-us/asp.net/aa336618.aspx

Brett
 
L

Laurent Bugnion

Hi,
Ok, not such a big deal.

It may not matter but I didn't have an "ASP.NET Web Application"
project icon in VS.NET 2005. I had to download two updates before it
appeared:

http://www.microsoft.com/downloads/...00-9554-4733-8725-3CA89DD9BFCA&displaylang=en

and

http://msdn2.microsoft.com/en-us/asp.net/aa336618.aspx

Brett

Yes, that's the WAP.

Based on what you posted earlier, my guess now is that you were actually
having a web site, and something when wrong when you published.

I will close this long thread here now, if you agree, because we are not
really going to go much further now :) I suggest that you make a few
tries with: Web site, WAP, publish, XCOPY, etc... and see how it works.
I think it's quite important to understand what happens then. Should
something strange (continue to) happen, I suggest trying a reinstall.
And of course, posting here remains a good idea if something is not clear.

Cheers,
Laurent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top