Add Web References problems

R

Russ

Hi All. I'm brand new to this but 3 days of working on it and scanning
literally thousands of user group messages has not solved my problem.

I have VS.Net 2003 installed on my dev machine (Win2K), and the server
components on my dev server (Win2K server), along with .net framework
v1.1. I am trying to go through the walkthrough titled "Creating a
Distributed Application".

I can create the WebService ok, on the server, but when I try to
create the client (on the dev machine), when I get to the step of
adding a web reference to the WebServer, one of the following happens.

A) If I add the line <identity impersonate="true"/> to the web.config
file, then I get an access denied error when trying to read
AuthorsService.asmx from the server. The stack trace it shows does me
absolutely no good as I have not a clue what all the numbers mean...

I have uninstalled the framework and reinstalled. On the server, in
the Local Security Policy, User Rights Assignment for "Impersonate a
Client after authentication" I have added the APSNET user. I also
added myself to the VS Developers group on the server. The server is
a domain controller, and I am the same user with same password on both
machines, and I am an administrator on both machines. I just don't
have a clue what to do about this.

B) I tried removing the line <identity impersonate="true"/> from the
Web.config file. This allows the asmx file to be read with no
problem. However when I tell it to "add reference", It does, but the
task window in VS shows the following error:

"E:\testNet\AuthorsWinClient\Web References\asrv\Reference.map(1):
Custom tool warning: DiscoCodeGenerator unable to initialize code
generator. No code generated."

I can find very little references to "DiscoCodeGenerator" via a google
search or via scanning the user groups, and what I did find does not
seem to address this problem.

The result of this seems to be that when I try to add the DataSet
control to the client, there are "no datasets in project". So I am at
a standstill in trying to learn more of this until someone can help me
fix this.

I do realize that I can install IIS on my dev machine, and maybe make
it work that way, but according to the article "Remote Server
Configuration for Developing Web Projects Using Visual Studio .NET" at
the url below, what I am doing should work.

Please help! Thanks, Russ


http://msdn.microsoft.com/library/d...developingwebprojectsusingvisualstudionet.asp
 
S

Steven Cheng[MSFT]

Hi Russ,

Regarding on the issue, we're
finding proper resource to assist you and we will update as soon as
posible. Thanks for your understanding.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security(This posting is provided "AS IS",
with no warranties, and confers no rights.)
 
R

Russ

Luke, thank you for the response. However I do not think it will
solve the problem. The article you refer me to is to correct a
problem with the .net framework version 1.0. Since I am using version
1.1 (I don't even have 1.0 installed), there is no path:
%Systemroot%\Microsoft.NET\Framework\v1.0.3705\CONFIG

I did try making the change in the V1.1\CONFIG\machine.config file,
and all the other changes suggested by the article to allow the use of
the ASPNET account (changing password, etc). The article recommends
this over using the System account due to security reasons, but
honestly I don't understand why since the ASPNET account has access
priviliges to everything.

Anyway when I made the changes, I started getting a lot of other error
messages. I can post them if you want, but because that was a V1.0
framework fix, I expect that I should put things back the way they
were and wait for you to come up with a different answer to my
dilemma.

Thanks for your continuing help.

Russ
 
M

[MSFT]

Hi Russ,

The problem mentioned in the KB article is still with framework 1.1 since
it is a permission issue with a DC. In the web.config, you have specified
<identity impersonate="true"/>. This requires impernate after
authentication. However, the ASPNET account may not have enough permission
to perform impersonate. Therefore, I suggest you begin with System account
and an ASP.NET project (it is easier to debug than a web service). See what
is the result you will get. If the ASP.NET project, then go on with a web
service project.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
R

Russ

Thank you Luke. I will do that. Maybe you should look into fixing the
KB article because it clearly says:
STATUS
Microsoft has confirmed that this is a bug in the Microsoft
products that are listed at the beginning of this article. This
bug was corrected in ASP.NET (included with the .NET Framework) 1.1.

Also, the bug that the KB article (#315158) describes does not seem to
exactly fit the results I am seeing. For instance it says that I will
see the messages:
Server Application Unavailable"

The web application you are attempting to access on this web server
is currently unavailable."

Please hit the "Refresh" button in your web browser to retry your request"

which I do not see, and that there will be an event logged in the
system app log:
aspnet_wp.exe could not be launched because the username and/or
password supplied in the processModel section of the config file are
invalid.
aspnet_wp.exe could not be started.
HRESULT for the failure: 80004005 "

I see nothing logged when my WebService fails - But I will take your
advice and try an ASP.NET project with the system account.

Thanks again, Russ
 
M

[MSFT]

Hi Russ,

Thank you for the information. To use impersonate, System account is a
better choice than ASPNET. You may try this and let me know the result. If
you have any further question, please feel free to let mw know.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
R

Russ

Luke, I removed and reinstalled the .net framework 1.1 and then
changed the userName in machine.config to "SYSTEM". This solved the
problem of <identity impersonate="true"/> causing a problem.

I can now read the asmx file when I try to add a web reference, and it
gives me no errors. However when I actually tell it to add a
reference to my AuthorsWinClient project, I still get the error:

"E:\testNet\AuthorsWinClient\Web References\asrv\Reference.map(1):
Custom tool warning: DiscoCodeGenerator unable to initialize code
generator. No code generated."

So when I try to add the DataSet control to the client, there are "no
datasets in project". What do you suggest?

Thank you, Russ
 
M

[MSFT]

Hi Russ,

Can you compile the Web service project and try to run it (A IE windows
will prompt you to test the web service)? If not, what is the error
Message? Additionally, from the error message in your message, I suspect if
the VS.NET has been installed completely. Can you not be able use a dataset
in any project?


Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
R

Russ

Luke, when I run the web service from Visual Studio, IE comes up with
a mostly blank page that says "Service1" in a blue bar across the top,
and the next line says:
The following operations are supported. For a formal definition,
please review the Service Description.

This appears to work properly??

I am a little concerned about the name "Service1" appearing like that.
Service1 is the name of the class in the AuthorsService.asmx file, and
I don't know why it should appear in the generated Web page. I see
that "Service1" is set to be the service name (as shown below), but
how did it get set that way? If this is normal behaviour then fine,
but I wanted to point it out in case it is part of the problem. I
would have thought the service name would be "AuthorsWebService".

When I click on the link "Service Description", I get the following:
<?xml version="1.0" encoding="utf-8" ?>
- <definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://asrv/webservices/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://asrv/webservices/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types />
<service name="Service1" />
</definitions>


As for adding a dataset, yes, I was able to add a dataset when
building the walkthrough named "Walkthrough: Simple Data Access in a
Windows Form", and the program works correctly. This was a C++
project, not a C# project though..

Russ
 
R

Russ

Luke, here is some followup information. I have been studying the
problem more...

When I get the error:
E:\testNet\AuthorsWinClient\Web References\asrv\Reference.map(1): Custom tool warning: DiscoCodeGenerator unable to initialize code generator. No code generated.

It references the file ReferenceMap, line 1. Here is that file:

<?xml version="1.0" encoding="utf-8"?>
<DiscoveryClientResultsFile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Results>
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://asrv/AuthorsWebService/AuthorsService.asmx?disco" filename="AuthorsService.disco" />
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://asrv/AuthorsWebService/AuthorsService.asmx?wsdl" filename="AuthorsService.wsdl" />
</Results>
</DiscoveryClientResultsFile>

Is there any problem with the file?


ALSO: You said "I suspect if the VS.NET has been installed
completely", based on the error message above. I took that to mean
that maybe disco.exe was not executing.

First I looked to be sure that Disco.exe exists. I found it at:

E:\Program Files\Microsoft Visual Studio .NET
2003\SDK\v1.1\Bin\disco.exe

Next, I wanted to see if that directory was included in the execute
dir's of Visual Studio. I found (under tools/options/executable
files, in projects/VC++ Directories): $(FrameworkSDKDir)bin. That is
how I expect VS finds the disco.exe file. (However I did not find any
C# Directories references.)

But when I looked at system or personal environment variables there
was no entry for "FrameworkSDKDir". So I added one, setting it to
E:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\

This did not help, the error message when trying to add a Web
reference is the same. From what I can tell, the problem is not that
disco does not execute, but that it has a problem with the map file.

I tried executing the disco program manually from command line. Here
is what I got:

E:\testNet\AuthorsWinClient\Web
References\asrv>e:\progra~1\micros~1.net\sdk\v1.1\bin\disco
http://asrv/AuthorsWebService/AuthorsService.asmx?disco
Microsoft (R) Web Services Discovery Utility
[Microsoft (R) .NET Framework, Version 1.1.4322.573]
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

Disco found documents at the following URLs:
http://asrv/AuthorsWebService/AuthorsService.asmx?disco
http://asrv/AuthorsWebService/AuthorsService.asmx?wsdl

The following files hold the content found at the corresponding URLs:
.\AuthorsService.disco <-
http://asrv/AuthorsWebService/AuthorsService.asmx?disco
.\AuthorsService.wsdl <-
http://asrv/AuthorsWebService/AuthorsService.asmx?wsdl
The file .\results.discomap holds links to each of these files.

I really don't know where to turn next...

Thanks, Russ
 
M

[MSFT]

Hi Russ,

From the information, you haven't added any web method in the web service.
A web service must have at least one web method, so that it can be added to
other projects. Otherwise, there will be such a problem as you said. You
can try to add a web method to the service code to see the result.

By the way, string "service1" in IE when you test the web service, is just
the class name you defined in the service code, like:

public class Service1 : System.Web.Services.WebService
{
...

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
R

Russ

Ok Luke. My problem is finally sorted out. I did add the Web method,
but it did not work. The reason is because of my unfamilarity with
C#. In the generated code it has the string "// [Webmethod]". Note
that it is commented out. Following that is a Hello World method that
is also commented out.

When the tutorial told me to insert Web Methods, I replaced the Hello
world method code, but did not uncomment the [WebMethod] line. I
thought it was supposed to be a comment line (since it was already
commented out).

Once you told me the problem was that I had no Web Method, I guessed
that line was not a comment, and fixed it.

Now I have successfully added a Web Reference.

I would suggest that somewhere an error message should be generated to
tell users that the problem is no web methods, rather than just
getting the very unrelated message about disco not being able to
initialize the code generator.

Thank you much for your time and patience helping me through these
beginner woes. C++ is SO MUCH easier!!! (because I already know it).

Regards, Russ
 
M

[MSFT]

Hi Russ,

I glad to heard the good news. Without the "[Webmethod]", the method will
be treated as normal method, which can only be called in the web service
internally, we have to add "[Webmethod]" for a public method.

Regards,

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
O

orna

Russ
I Confront the same problem do you have the answer yet???

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top