Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 143989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:10:56+00:00 2026-05-11T08:10:56+00:00

I am calling the SQL Server Reporting Services Webservice from inside an asp.net application.

  • 0

I am calling the SQL Server Reporting Services Webservice from inside an asp.net application. I need to fire off all the subscriptions for a given report. But I don’t want the user to have to wait around for it to all happen, so I want to have all the webservice calls inside a separate thread, and return to the user straight away.

I am using code that looks something like this:

public static void FireAllAsync(string ReportPath) {     Hashtable paramValues = new Hashtable();     ThreadPool.QueueUserWorkItem(new WaitCallback(FireAll), ReportPath); }  public static void FireAll(object ReportPath) {      ReportingService rs = new ReportingService();     rs.Credentials = System.Net.CredentialCache.DefaultCredentials;      Subscription[] SubList = rs.ListSubscriptions((string)ReportPath, null);      foreach (Subscription CurSub in SubList) {         rs.FireEvent(CurSub.EventType, CurSub.SubscriptionID);     }  } 

Calling FireAll works fine, but trying to call FireAllAsync to use the Thread fails with a 401 error. I believe the problem with the credentials not getting passed through properly. ie this line of code here:

rs.Credentials = System.Net.CredentialCache.DefaultCredentials; 

I do not have a good understanding of how the credentials cache works, so I can’t figure out why it doesn’t like being in a separate thread.

I have tried grabbing the credentials in the outer function, and passing them through as an argument, but the same error occurs.

Does anyone have any ideas what may be happening?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:10:57+00:00Added an answer on May 11, 2026 at 8:10 am

    When your primary thread is executing, it has an impersonation context prepared for it. In an authenticated scenario, IIS has authenticated the user, and then set the thread token – not the process token – for that user.

    Because the thread token is set for the user, that thread can then act on behalf of the user (on the local box; acting on behalf of the user on another box requires delegation to be set up if Integrated Windows Authentication (NTLM/Kerberos) is used).

    But, if you spin off a worker thread without any identity information, that worker thread will be spawned without its own token, so it’ll use the process token.

    If you can do what you need to do on the initial thread, you don’t have a delegation problem, just a lack of the user token on the worker thread.

    Threadpool threads will run as the process identity (NetworkService by default, so the computer account of the hosting machine, unless your App Pool is set to run as SomeUser, in which case all worker threads will run as SomeUser) – and if that user has access to whatever it is the initial user wants, all is good.

    If not, 401sville.

    There are web references that can help work around this, with various possible answers:

    Link

    http://aspalliance.com/articleViewer.aspx?aId=650&pId=2

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 110k
  • Answers 110k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can set the ModalPopupExtender's backgroundCssClass within the actual HTML… May 11, 2026 at 9:34 pm
  • Editorial Team
    Editorial Team added an answer If you are using MS SQL Server, you'll want to… May 11, 2026 at 9:34 pm
  • Editorial Team
    Editorial Team added an answer Since my web service is running in the context of… May 11, 2026 at 9:34 pm

Related Questions

I am getting the error OperationalError: FATAL: sorry, too many clients already when using
I'm using C++ to query a SQL Server 2005 database using ODBC. The queries
Hey all, I'm pulling my hair out on this one. I've checked all my
i'm a long-time newbie to c#, and this question may be too obvious, so

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.