5

I'm currently developing an ASP.net application. On localhost I can access Active Directory when calling AuthorizationGroups. After I published my ASP.net app to the server, I can't access Active Directory. I need to know why this is occuring on the server, when locally it worked fine? Do I need to import special DLLs?

As said I try to get the AuthorizationGroups from ActiveDirectory, I get the following message from the server.

-While trying to retrieve the authorization groups, an error (5) occurred.

Tassisto
  • 9,877
  • 28
  • 100
  • 157
  • 5
    Can be many reasons. Different configuration, different software versions, missing software... without seeing the errors it is impossible to tell. – Oded May 05 '11 at 08:22
  • 1
    Can you include the errors you are getting here ? – Jayantha Lal Sirisena May 05 '11 at 08:23
  • I have a problem with calling a method. This is the error Message: While trying to retrieve the authorization groups, an error (5) occurred. – Tassisto May 05 '11 at 08:44
  • hope the answers to be general , and not focus on the special problem only. – Anyname Donotcare May 05 '11 at 09:17
  • To me your question sounds too broad. Please be more specific, add your code segment where the Exception happens and the exact Exception properties to your question. Some links about general differences between IIS and Cassini: http://www.asp.net/hosting/tutorials/core-differences-between-iis-and-the-asp-net-development-server-cs http://stackoverflow.com/questions/103785/what-are-the-disadvantages-of-using-cassini-instead-of-iis http://stackoverflow.com/questions/2468925/cassini-vs-iis-authentication-issue http://stackoverflow.com/questions/2491608/differences-in-behaviour-between-iis-and-the- – oleschri May 13 '11 at 13:12
  • Any chance this question is an exact duplicate of your question here http://stackoverflow.com/questions/5814561/while-trying-to-retrieve-the-authorization-groups-an-error-5-occurred ? – oleschri May 13 '11 at 13:20

9 Answers9

5

Seriously, is that the full error information?

You Need to have logging of errors in place, even if that's the default that happens on an unhanded exception and you can check the Event Viewer.

So my answer is that you have to learn how to diagnose about any type of error in your site. If you are not prepared for that, it'll mean trouble later on when you are not the one that got the error.

As for the specific error, without the stacktrace we won't be able to advice you anymore than google. There isn't just one scenario where you can get that error, check the first few entries on google to see what I mean: http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=While+trying+to+retrieve+the+authorization+groups%2C+an+error+(5)+occurred

eglasius
  • 35,831
  • 5
  • 65
  • 110
1

The error message you quote sounds very much like a firewall issue

Can you turn off Windows Firewall on the server, and see if you get the error? If so, you have to open up some ports to access AD

But I agree with Oded's comment, there are many possibilities and you shouldn't really be surprised to see different behaviour - difference in Windows server / desktop configuration, and security, firewall config, ACL's, missing components - the list goes on.

Matt Evans
  • 7,113
  • 7
  • 32
  • 64
1

There could be a lot of causes:

  • IIS was missconfigured
  • IIS runs a different .NET version
  • Your application was missconfigured
  • Your application lacks compatibility with your IIS (Paths, Libraries, ...)
  • Something (probably Windows) is broken

The error you specified could come from:

  • ActiveDirectory fails to reply within time
  • Your application generally fails to connect to ActiveDirectory
  • Something is broken

Googling the error number (5) could help.

Cobra_Fast
  • 15,671
  • 8
  • 57
  • 102
1

probably a user context issue. When running locally, the web server is running as the logged in user. When running on IIS, the service is probably running as the local system account which doesn't have network access to get to the AD. You can change the user to be network service which will give the IIS server access to the AD.

Mike
  • 3,462
  • 22
  • 25
  • 1
    -1 This is absolutely not true, LocalSystem does have permission to access the network and get to AD. See http://stackoverflow.com/questions/510170/the-difference-between-the-local-system-account-and-the-network-service-accou/510225#510225 for a very complete description. – Peter Oehlert May 15 '11 at 17:27
1

It sounds like the only difference between the two would be the security permission of the user account the application is running under.

As a local user, you would nromally have access to bind against Active Directory. By default, IIS runs the application pool for a website using an account without network access. This would prevent you from connecting to you Active Directory Server.

If you were to change that application pool to run as Network Service, you may then encounter the error that the user account does not have permissions to connect to Active Directory.

Pervez Choudhury
  • 2,892
  • 3
  • 27
  • 28
0

Consider using IIS Express during development so that your development web server more closely matches production environments.

Nathan
  • 6,095
  • 2
  • 35
  • 61
0

mistake could be in your web.config file and deployment settings on IIS

Vikky
  • 752
  • 3
  • 15
  • 35
0

There are many reasons for why things work on local, but don't on deployed.

  • IMO, the number one is difference is permission levels - as others have pointed out, you may have to elevate permissions properly when accessing resources (such as active directory), or you may have to change the account under which your asp.net application is running on the server.
  • The second reason for why it may not work is that you may have absolute URIs in your code based on your local URIs, or you may have relative URIs which don't make a lot of sense in the server environment (different depths of folder structures, etc.)
  • Sometimes, you are developing on a newer framework version and that is not available on the server.
  • And sometimes you may have installed some third party frameworks that you are using which are not deployed on the server.

Most often the cause is one or the other of the above.

Vaibhav
  • 11,310
  • 11
  • 51
  • 70
0

Biggest difference is that the development server runs in the context of the logged in user, usually a local admin account and IIS runs in the context of the ASP.NET process account. Check permissions. And logs.

and going through this article will surely help you

Core Differences Between IIS and the ASP.NET Development Server

Vishwanath Dalvi
  • 35,388
  • 41
  • 123
  • 155