472,133 Members | 1,196 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,133 software developers and data experts.

Could not create type 'xxx' (trying to add web reference to project)

JT
Okay, I've seen about 4 years' worth of posts about this with no
viable solutions. I've spent 9 hours today trying to fix this. It
works BEAUTIFULLY on my local IIS installation, but when I publish to
my web host and try to add a web reference I get the following:

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

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 create type 'BaseTaskWS'.

Source Error:
Line 1: <%@ WebService Language="C#" CodeBehind="~/App_Code/
BaseTaskWS.cs" Class="BaseTaskWS" %>

Source File: /Services/BaseTask/BaseTaskWS.asmx Line: 1
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42;
ASP.NET Version:2.0.50727.210

I have created plenty of web services. I have had two hosted by my
web host for months. They worked fine. Now I've published this and
tested it and I get that error. Also, my original two give me the
exact same error. I can see that the overall site is set to .NET 2.0,
but I can't see what the virtual directories are set to. The tech
support guy says that it defaults to the same as the overall site, but
he hasn't verified that it really is the same. Either this is the
worst initiation joke ever, or no one really knows how to fix it or
ever posts the true fix. Could some MS MVP or other guru please help
me out with this? I promise I'll post the answer for everyone else
that stumbles into this. I've tried just about everything I've seen
in all the posts in this forum and as many others as I could find in a
day and nothing fixes it.

I have a really big magnet, and I'm not afraid to use it! Don't make
me go there...

Thanks,

JT

Feb 20 '07 #1
2 9098
Hi,

JT wrote:
Okay, I've seen about 4 years' worth of posts about this with no
viable solutions. I've spent 9 hours today trying to fix this. It
works BEAUTIFULLY on my local IIS installation, but when I publish to
my web host and try to add a web reference I get the following:

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

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 create type 'BaseTaskWS'.

Source Error:
Line 1: <%@ WebService Language="C#" CodeBehind="~/App_Code/
BaseTaskWS.cs" Class="BaseTaskWS" %>
How did you publish the code-behind to the web? The class BaseTaskWS is
not found.

In ASP.NET 2.0, there are three ways to publish web services:

1) Using the "New website" menu to create your project, you then copy
the source code files to the web server together with your other, usual
files (ASPX, ASMX...). No DLL involved here, the source code files will
be compiled on the fly. In that case, the reference to the class is
added using the same syntax as you copied above, but the class file must
be copied to the web server too.

2) Using the same option, but then using the "Build / Publish" menu.
This will precompile the site, creating a DLL. In this process, you
cannot specifiy the DLL's name. If you used the "publish" option, then a
"bin" folder is created and the DLL is found in that.

3) Using the Web Application Project (WAP) add-on. In this case you use
the menu "New project" and then under "Web" you select the "Web service
application" template. In that case, it's much more like ASP.NET 1.1,
and it's rather recommend to work with that add-on.

The WAP add-on is part of VS2005 SP1, but if you don't have SP1, you can
also install it separately from here:
http://webproject.scottgu.com/

I realize that this information might not be the cause of the problem,
but it's a start, so don't hesitate to ask more if that doesn't solve
your problem.

HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Feb 20 '07 #2
JT
Hi Laurent,

Thanks for your reply. I used method 2.

Here's what caused my problem:
I created my virtual directory using the Helm control panel. The
instructions in my web host's knowledge base were very clear. I
didn't refer to the knowledge base. The path to my directory was
wwwroot/Services/BaseSecurity. The virtual directory was called
BaseSecurity, meaning I would reference it by wwwroot/BaseSecurity. I
was referencing it by wwwroot/Services/BaseSecurity. It didn't know
that was the same thing. I was giving it a true physical path, not a
virtual directory path. I've made them all the same so I don't forget
in the future and waste another day.

Note: No hard drives were harmed in the development of this web
service.

JT

Feb 22 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Kevin Rose | last post: by
17 posts views Thread by Chris Podmore | last post: by
4 posts views Thread by vncntj | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.