有一个与QUOT; 401 - 未授权"我想在IIS WCF数据服务时,我想、有一个、数据、QUOT

2023-09-03 07:14:11 作者:天涯浪人

我开发了一个WCF数据服务,它运行良好,我所能做的每一次操作我想通过。

I developed a WCF Data Service, which runs fine, I can do every operation I want through.

我开发了一个小型的C#客户端,测试所有功能:添加,删除,修改,检索数据。

I developed a small c# client which tests all functions: adding, removing, modifying, retrieving data.

一切正常,我的Visual Studio的服务器上,但一旦我的IIS服务器上:

Everything works fine on my visual studio server, but once I'm on the IIS Server:

我可以添加/检索数据 在我不能编辑数据

当我尝试编辑数据我得到这个错误:

When I try to edit data I get this error:

System.Data.Services.Client.DataServiceRequestException是未处理   消息=宇根ERREUR s'est produite LORS杜TRAITEMENT德cette   requête。   来源= System.Data.Services.Client   堆栈跟踪:   àSystem.Data.Services.Client.DataServiceContext.SaveResult.HandleBatchResponse()   àSystem.Data.Services.Client.DataServiceContext.SaveResult.EndRequest()   àSystem.Data.Services.Client.DataServiceContext.SaveChanges(SaveChangesOptions   选项​​)   àSystem.Data.Services.Client.DataServiceContext.SaveChanges()   àWSTester.Program.ModifySomeThings(实体实体)丹斯   D:\工作区\ 10067.GfK   Telecontrol.TOM \发布\ V3.1 \ WSTester \ Program.cs的:LIGNE 90   àWSTester.Program.Main(字串[] args)丹斯   D:\工作区\ 10067.GfK   Telecontrol.TOM \发布\ V3.1 \ WSTester \ Program.cs的:LIGNE 23   àSystem.AppDomain._nExecuteAssembly(RuntimeAssembly   装配,字串[] args)   àSystem.AppDomain.ExecuteAssembly(字符串assemblyFile,   证据assemblySecurity,字串[] args)   àMicrosoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()   àSystem.Threading.ThreadHelper.ThreadStart_Context(对象   状态)   àSystem.Threading.ExecutionContext.Run(执行上下文   执行上下文,ContextCallback回调,对象的状态,布尔   ignoreSyncCtx)   àSystem.Threading.ExecutionContext.Run(执行上下文   执行上下文,ContextCallback回调,对象的状态)   àSystem.Threading.ThreadHelper.ThreadStart()   的InnerException:   System.Data.Services.Client.DataServiceClientException   消息=   严格// ENhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>                    401 - 未经授权:访问被拒绝由于无效   凭据。                    

.content容器{背景:#FFF;宽度:96%;保证金顶:8像素;填充:10px的;位置:亲属;}        - >                            

服务器错误

                       

401 - 未经授权:访问被拒绝由于无效   凭据。

        

您没有权限查看此目录或页面   使用您提供的凭据。

                              

System.Data.Services.Client.DataServiceRequestException was unhandled Message=Une erreur s'est produite lors du traitement de cette requête. Source=System.Data.Services.Client StackTrace: à System.Data.Services.Client.DataServiceContext.SaveResult.HandleBatchResponse() à System.Data.Services.Client.DataServiceContext.SaveResult.EndRequest() à System.Data.Services.Client.DataServiceContext.SaveChanges(SaveChangesOptions options) à System.Data.Services.Client.DataServiceContext.SaveChanges() à WSTester.Program.ModifySomeThings(Entities entities) dans D:\Workspace\10067.GfK Telecontrol.TOM\Release\V3.1\WSTester\Program.cs:ligne 90 à WSTester.Program.Main(String[] args) dans D:\Workspace\10067.GfK Telecontrol.TOM\Release\V3.1\WSTester\Program.cs:ligne 23 à System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) à System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() à System.Threading.ThreadHelper.ThreadStart_Context(Object state) à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) à System.Threading.ThreadHelper.ThreadStart() InnerException: System.Data.Services.Client.DataServiceClientException Message= Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 401 - Unauthorized: Access is denied due to invalid credentials.

.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;} -->

Server Error

401 - Unauthorized: Access is denied due to invalid credentials.

You do not have permission to view this directory or page using the credentials that you supplied.

来源= System.Data.Services.Client   状态code = 401   堆栈跟踪:   àSystem.Data.Services.Client.DataServiceContext.SaveResult.d__1e.MoveNext()   的InnerException:

Source=System.Data.Services.Client StatusCode=401 StackTrace: à System.Data.Services.Client.DataServiceContext.SaveResult.d__1e.MoveNext() InnerException:

这是奇怪,因为我所有的权利,我的WCF数据服务(它与Visual Studio的作品),我在IIS匿名的方式,所以我应该有完全的权利运行此查询。 IIS_USR对网络文件夹完全控制,所以我实在看不出有什么可以是问题

Which is strange, because I've all rights in my WCF Data service(and it works with visual studio), and I'm in anonymous mode in IIS, so I should have all rights to runs this query. IIS_USR has FULL CONTROL on the web folder, so I really don't see what can be the problem

推荐答案

请尝试使用应用程序池的模拟功能,用户有权限我已经使用IIS 7,一般默认AppPoolIdentity功能已经在过去的许多问题其分配到一个用户设置为这个目的,或将其设置为使用网络服务

try using using the impersonation features of the app pool to user that has permissions i have had many problems in the past using the default AppPoolIdentity features of iis 7 and generally assign it to either a user setup for this very purpose or set it to use networkservice

这是最有可能的是,池doenst具有适当的权限,以正确执行

it is most likely that the pool doenst have the proper permissions to execute properly