Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / February 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JT - 20 Feb 2007 00:14 GMT
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
Laurent Bugnion [MVP] - 20 Feb 2007 08:29 GMT
Hi,

> 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
[quoted text clipped - 15 lines]
> 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
Signature

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

JT - 22 Feb 2007 17:31 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.