?
Solved

ASP.NET + Impersonating in Web Service

Posted on 2005-03-26
12
Medium Priority
?
557 Views
Last Modified: 2008-02-26
We have a webservice that exposes a public method with SoapDocumentMethod(OneWay:=True).  What is the identity it's using to process?  Web.config for the web service is set to imporsonate identity impersonate="true" userName="<username>" password="<password>" but it's not using it.

Keep getting the following error: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

If i remove SoapDocumentMethod(OneWay:=True) it seems to work, the reason i want this is i don't want the application to wait for the webservice to finish.
0
Comment
Question by:dkilby
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 
LVL 20

Expert Comment

by:ihenry
ID: 13636842
The error you're getting might be due to a problem with the SQL Server not being able to authenticate your web service security context and happens when the SQL Server is running on different machine. Can you explain a little bit more about IIS authentication method used? and it would be more helpful if you can print out the web service security context identity name so that you can tell what user account is actually being authenticated to the SQL Server.
0
 

Author Comment

by:dkilby
ID: 13636869
Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=<database>;Data Source=<server>;Connect Timeout=1800;

the imperosonation is in the web.config

SQL Server is running on a different machine,  the thing i don't understand is if i remove SoapDocumentMethod(OneWay:=True) it seems to work.
0
 
LVL 20

Expert Comment

by:ihenry
ID: 13636885
Can you post here the exception stack trace?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:dkilby
ID: 13636895
From doing some other research it seems that the webservice is not reading the web.config, so if the webservice doesnt have access to HttpContext how else can it impersonate??
0
 
LVL 20

Expert Comment

by:ihenry
ID: 13636929
are you using .NET Framework version 1.0?
0
 

Author Comment

by:dkilby
ID: 13636955
Using v1.1.4322

Here is the error

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
DEVELOPMENT server connection string:Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=testDB_Dev;Data Source=sqlmachine;Connect Timeout=1800; Context Identity:  
0
 
LVL 20

Expert Comment

by:ihenry
ID: 13636988
Let me guess, code in your webmethod is trying to connect to database with a connection string supplied from web.config. Do some debugging and check if you're able to get the connection string in the first place. Then, before open a connection to database print out Thread.CurrentPrincipal.Identity.Name and see what's the value.
0
 

Author Comment

by:dkilby
ID: 13637015
but the connection string is showing up in the connection string
0
 
LVL 20

Expert Comment

by:ihenry
ID: 13637017
I find your problem is weird since SoapDocumentMethodAttribute is unlikely to cause this kind of problem. Just need some more information, is the SQL Server in the same domain with your Web Server? are you login with domain account? and is your login account is enabled for delegation?
0
 

Author Comment

by:dkilby
ID: 13637033
the sql server is on the same domain as the web server, i am logged in with domain account if the webservice can read the web.config file

The most confusing part is why it won't read the web.config when i have SoapDocumentMethod(OneWay:=True), i just tried running the app without it and it inserted data into the database no problem, as soon as i put it back i get the error.
0
 
LVL 20

Accepted Solution

by:
ihenry earned 2000 total points
ID: 13639425
This problem had made me really curious. So I tried google to see if anyone has come across to the same problem. I found a few similar questions posted in some forums but unfortunately no solution at all. Now I think I'm really out of good idea. And my last suggestion for you is to post a new question which link to this so others who have more experience in this area can give you better help.
0
 
LVL 11

Expert Comment

by:sachiek
ID: 13650811
I am bit curious to know why you are choosing this SoapDocumentMethod ?
SoapDocumentMethod will help your webservice to fire-and-forget kind of job.

Also can I know which WSE you are using ?Which version?

Sachi
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question