简体   繁体   中英

Web Application working in VS Development Server but don't work in IIS

I've a ASP.Net application which utilizes SQL Server Stored Procedures and Web Services using Windows Authentication. The idea is to use the logged in user credentials for invoking the web service (This is critical since the web service use the authentication credentials to assign the owner of the created or updated record) and for executing the stored procedure.

When I am using VS.Net integrated web server the result is just fine (May be because this server starts under current logged in user account) The SQL Server SP returns expected results (Even when I execute them from Query Analyzer) and web service credentials is set correctly to the current logged in user.

However when I host the application in local IIS it's not working as expectedly. The Sql Server stored procedure returns EMPTY dataset and web service credentials is set to empty.

I am using

myService.Credentials = System.Net.CredentialsCache.DefaultCredentials

Bothe the web service host virtual directory and my application virtual directory is using Windows Authentication in Directory Security of IIS.

Any one has any idea???

Your local IIS with most likly run the applicationpool that is hosting your asp.net as the user networkservice.
It seems like your asp.net application is not correctly using the windowsauthentification. Are you sure that you are correctly logged it? Create a new blank page and set a breakpoint to the Page_Onload method. There in you go to the (I think its the prompt window) and type in this.User.Identity.Name and see if it matches your windows login

under IIS Manager. Click on Website - > Properties and opt Directory Security. Then Anonymous Access and Authntication Control, then opt Windows Integrated to allow windows domain users. To access website

Unfortunately I've not found why. However to resolve this I've used impersonation.

Regarding SPs returning not any values. I've figured out that I've using Views from SPs and some how The logged in windows account doesn't have enough permission on those Views.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM