awesj

I know this question has been asked a billion times already because I've found several instances on the net, but none of the proposed solutions seems to solve my problem, so I'd appreciate any help.

I've created a C# webservice on my local machine that runs fine. Now I'm trying to deploy it to a webserver. The server is Windows 2003 with IIS 6. I created a new virtual directory in IIS, set it to be an application, and gave it "scripts only" execute permissions. I've manually copied all the files from my local webservice directoy to the virtual directory on the server. When I try to access the page, I get the dreaded "Could not create type 'Service'" message. Here is some additional interesting information:

1. I'm new to VS 2005 / .NET 2.0, and still kind of new to webservices in general. I've noticed that when I build the webservice on my local machine, it doesn't create a .dll for my service like webservices I created with VS 2003. Instead the App_Code directory sits in the virtual directory containing my code file, and apparently the website is dynamically compiling it. There is no 'Bin' directory (well, technically there is because I added a reference to a class library, and it's dll sits there, but there's nothing compiled from my project there). Is this copacetic I read up on the "publish web site" feature that is supposed to generate an already-compiled dll, but when I tried it it didn't work either.

2. My local machine is running IIS 5. On the settings for the local virtual directory, I've noticed that the web service is set to use integrated windows authentication (might have set that myself manually, don't remember). By default it's not on the production web server, but turning that on does not make it work.

3. On the ASP.NET tab of the virtual directory properties, by default the asp version was set to 1.1 (under which I get the "Could not create type" error). When I try changing it to 2.0 (which I figure is what I need, given that I developed the service under 2.0), I get a "Page cannot be displayed" error instead.

4. I tried at one point creating a web deployment project, which created an msi file I ran on the webserver. All that seemed to do was do exactly what I did manually, still resulting in a non-working web service.

Why is setting up a virtually trivial web service so stinking hard



Re: ASMX Web Services and XML Serialization "Could not create type..." error deploying webservice

Daniel Roth

Hello,

Could you please post the entire error message Was there any indication as to why the Service instance could not be created

Daniel Roth






Re: ASMX Web Services and XML Serialization "Could not create type..." error deploying webservice

Armoghan

I am getting the same error.

I have Visual Studio 2005 Team Edition for Software Developers.

I am doing the following steps

1. Create New Web Service

2. Right Click on Project and Publish at http://localhost/Website2

First it gives the following error

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Unrecognized configuration section 'connectionStrings'

Source Error:

Line 10: <configuration>
Line 11:   <appSettings/>
Line 12:   <connectionStrings/>
Line 13:   <system.web>
Line 14:     <!-- 

Source File: c:\inetpub\wwwroot\Website2\web.config Line: 12




Re: ASMX Web Services and XML Serialization "Could not create type..." error deploying webservice

Armoghan

Sorry guys, i Found the problem. I also had ASP.NET 1.1 installed on the system and IIS was pointing to it





Re: ASMX Web Services and XML Serialization "Could not create type..." error deploying webservice

Hardik Mehta

Hello Friends,

The problem is because your application is using ASP.NET V1.1 for the execution of Webservice build in ASP.NET V2.0

Here is the solution.

just go to the properties of your virtual directory.

now go ot the ASP.NET Tab

here change ASP.NET Version from 1.1 to 2.0

Thank You,
Hardik Mehta.






Re: ASMX Web Services and XML Serialization "Could not create type..." error deploying webservice

akois

still not work after i follow that solution...

any idea






Re: ASMX Web Services and XML Serialization "Could not create type..." error deploying webservice

akois

i got the solution..

make sure set your

1. webservice.asmx file properties > Build set to Contents

2. webservice.asmx.vb file properties > Build set to Compile






Re: ASMX Web Services and XML Serialization "Could not create type..." error deploying webservice

Waheeda

ASP.NET 2.0 seems to assume that its App_Code directory is right underneath the vroot. Just make sure the reference to the vdir is pointed correctly.




Re: ASMX Web Services and XML Serialization "Could not create type..." error deploying webservice

pragaw

I had the same problem and I was going nuts to find the solution.

Hardik's  suggestion works. Thanks.





Re: ASMX Web Services and XML Serialization "Could not create type..." error deploying webservice

Kvltv

akois wrote:

i got the solution..

make sure set your

1. webservice.asmx file properties > Build set to Contents

2. webservice.asmx.vb file properties > Build set to Compile

think running on the local server is a starter part of the problem.After thousands of forum and resource search i came over the deployement problem of web services.

This answer may not match the question but someone should concern about the problems while deploying web service to web.
First of all you have correct the problems depends on the configurations on web.config file.Remove the authantication setting and define custom error tag like below.Also before deploying, you may set compilation debug to "false".

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<
error statusCode="403" redirect="NoAccess.htm"/>
<
error statusCode="404" redirect="FileNotFound.htm"/>
</customErrors>

Be sure web service is running on local.After this upload the directory, enter the control panel of your hosting (plesk or cpanel) create virtual directory which shows the real one.

Open internet explorer and write the url of virtual directory.

The reason i wrote these is that i have searched a lot about this but the is no answer about this problem.At last i found it and wanted to share this information.I appologise If there is any grammer or spelling mistakes.

Thanks everybody... Kvtlv






Re: ASMX Web Services and XML Serialization "Could not create type..." error deploying webservice

KevinMcConathy

This is what worked for me.

Open IIS Manager

In the left "tree view" find "Web Service Extensions" and highlight it.

Locate the "ASP.NET v2.0.50727" element, highlight it and click the Allow button. This will make Framework 2.0 your default ASP version.

Next, go to the properties dialog of your Web Service Site (still in IIS Manager) and select the ASP.NET tab. Set the Framework version to 2.0.50727.

I puzzled over this for at least a day. Now I'm as happy as a little girl!





Re: ASMX Web Services and XML Serialization "Could not create type..." error deploying webservice

Kapil

make sure you have the [WebMethod] addribute set on all your methods.





Re: ASMX Web Services and XML Serialization "Could not create type..." error deploying webservice

dB.

A typical problem is that the class name doesn't match. For example, the class may be in a namespace and the .asmx file doesn't properly reference that namespace. Example:

<%@ WebService Language="C#" CodeBehind="~/App_Code/WebBackEndService.cs" Class="SnCore.BackEndServices.WebBackEndService" %>

code would be

namespace SnCore.WebServices
{
[WebService(Namespace = "http://www.vestris.com/sncore/ns/", Name = "WebContentService")]
[
WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class WebContentService : WebService { ...





Re: ASMX Web Services and XML Serialization "Could not create type..." error deploying webservice

dB.

A typical problem is that the class name doesn't match. For example, the class may be in a namespace and the .asmx file doesn't properly reference that namespace. Example:

<%@ WebService Language="C#" CodeBehind="~/App_Code/WebBackEndService.cs" Class="SnCore.BackEndServices.WebBackEndService" %>

code would be

namespace SnCore.BackEndServices
{
[WebService(Namespace = "http://www.vestris.com/sncore/ns/", Name = "WebBackEndService")]
[
WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class WebBackEndService : WebService { ...





Re: ASMX Web Services and XML Serialization "Could not create type..." error deploying webservice

ismaelc

I was accessing a subdirectory of the vroot, and changed the reference location in the asmx file but still didn't work. When I made the subdirectory to a virtual directory, it worked.