Web 服务中方法的访问被拒绝错误 [英] Access Denied Error for a method in web service

查看:25
本文介绍了Web 服务中方法的访问被拒绝错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个从本地主机完美运行的网络服务,但是当我将它托管在测试服务器上时,我在其中一种方法上遇到错误.我正在使用 wsHttp 绑定.除此方法外,其他一切都在客户端正常工作.这是我得到的错误

I have a webservice that works perfectly from localhost but when I hosted it on the testing server I get an error on one of the methods. I am using wsHttp Binding. everything else works fine on the client side except for this method. This is the error that I am getting

客户端错误:

System.ServiceModel.Security.SecurityAccessDeniedException: Access is denied.

Server stack trace: 
   at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

服务器错误:

namespace.Service Error: 10001 : Error occurred in methodname(). 
 System.Security.SecurityException: The source was not found, but some or all event logs could not be searched.  Inaccessible logs: Security.
   at System.Diagnostics.EventLog.FindSourceRegistration(String source, String machineName, Boolean readOnly)
   at System.Diagnostics.EventLog.SourceExists(String source, String machineName)
   at System.Diagnostics.EventLog.VerifyAndCreateSource(String sourceName, String currentMachineName)
   at System.Diagnostics.EventLog.WriteEvent(EventInstance instance, Byte[] data, Object[] values)
   at System.Diagnostics.EventLog.WriteEvent(EventInstance instance, Object[] values)
   at System.Diagnostics.EventLogTraceListener.TraceEvent(TraceEventCache eventCache, String source, TraceEventType severity, Int32 id, String format, Object[] args)
   at System.Diagnostics.TraceSource.TraceEvent(TraceEventType eventType, Int32 id, String format, Object[] args)
   at AutoWatch.Entity.WcfService.TrackingService.UpdateIncidentStatusHistory(Int64 incidentId, String status, String username, String comment, Boolean SuspectFaultyUnit) in C:\..servicename.cs:line 566
   at AutoWatch.Entity.WcfService.TrackingService.GetNewIncidentMessage(String username) in C:\..servicename.cs:line 444

失败的程序集的区域是:我的电脑

The Zone of the assembly that failed was: MyComputer

我添加了我在服务器上遇到的错误.是否有可能我收到此错误是因为服务无法写入事件日志?

I added in the error I am getting on the server. Is it possible I am getting this error because the service cannot write to the event log?

请帮忙.

推荐答案

确保运行托管服务的进程的帐户具有对数据库的访问权限.例如,在 IIS 的情况下,运行托管服务的应用程序池的帐户必须登录到数据库服务器,并且它必须有权在您的数据库中执行所有必要的操作.

Ensure that account running your process where the service is hosted has access rights to the database. For example in case of IIS the account running the application pool where the service is hosted must have login to database server and it must have permissions to do all necessary operations in your database.

服务器堆栈跟踪看起来很简单.您在写入 Windows 事件日志时遇到问题!它找不到您请求的来源,也没有创建它的权限.

The server stack trace looks quite straightforward. You have a problem with writing to Windows Event Log! It cannot find source you requested and it doesn't have permission to create it.

这篇关于Web 服务中方法的访问被拒绝错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆