我从Photon Server应用程序运行AWS SDK,并尝试使用基于AWS站点示例的AmazonS3Client.ListObjectsV2()方法查询S3存储桶的内容。在另一个应用程序中使用相同的代码工作正常,但在Photon Server应用程序中,它将以下错误消息输出到Photon日志
2016-10-12 15:19:52,614 [11] ERROR Photon.SocketServer.ApplicationBase [(null)] - System.NullReferenceException: Object reference not set to an instance of an object.
at System.Security.Permissions.FileIOPermission.CheckIllegalCharacters(String[] str, Boolean onlyCheckExtras)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
at System.Configuration.UriSectionReader.GetSectionData()
at System.Configuration.UriSectionInternal.LoadUsingCustomParser(String appConfigFilePath)
at System.Configuration.UriSectionInternal.GetSection()
at System.Uri.InitializeUriConfig()
at System.Uri.InitializeUri(ParsingError err, UriKind uriKind, UriFormatException& e)
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at Amazon.Runtime.AmazonServiceClient.ComposeUrl(IRequest iRequest)
at Amazon.Runtime.Internal.HttpHandler`1.CreateWebRequest(IRequestContext requestContext)
at Amazon.Runtime.Internal.HttpHandler`1.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.RedirectHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.Unmarshaller.InvokeSync(IExecutionContext executionContext)
at Amazon.S3.Internal.AmazonS3ResponseHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.ErrorHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.RetryHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.S3.Internal.AmazonS3ExceptionHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.MetricsHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.RuntimePipeline.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.AmazonServiceClient.Invoke[TRequest,TResponse](TRequest request, IMarshaller`2 marshaller, ResponseUnmarshaller unmarshaller)
at Amazon.S3.AmazonS3Client.ListObjectsV2(ListObjectsV2Request request)
at AWSConnector.AWSConnector.ListSubfolders(String prefix)
at InstanceManager.Handlers.InstanceManagerUpdateInstancesHandler.OnHandleMessage(IMessage message, PhotonServerPeer serverPeer)
at Boson.Photon.Server.PhotonServerHandlerList.HandleMessage(IMessage message, PhotonServerPeer peer)
at Boson.Photon.Server.PhotonServerPeer.OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters)
at Photon.SocketServer.ServerToServer.ServerPeerBase.OnReceiveInternal(Byte[] data, SendParameters sendParameters, Int32 rtt, Int32 rttVariance, Int32 numFailures)
at Photon.SocketServer.PeerBase.<>c__DisplayClass6.<Photon.SocketServer.IManagedPeer.Application_OnReceive>b__5()
at ExitGames.Concurrency.Core.DefaultExecutor.Execute(Action toExecute)
at ExitGames.Concurrency.Core.DefaultExecutor.Execute(List`1 toExecute)
at ExitGames.Concurrency.Fibers.PoolFiber.Flush(Object )
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
我担心这可能与Photon处理线程的方式有关。
答案 0 :(得分:1)
不幸的是,我相信Photon和AWS都没有参与其中。 &#34; System.Security.Permissions.FileIOPermission.CheckIllegalCharacters(String [] str,Boolean onlyCheckExtras)&#34;方法在其他方案中抛出NRE。它似乎与微软部署的最新安全修复程序一致。
例如,这是我现在正在努力的堆栈跟踪:
at System.Security.Permissions.FileIOPermission.CheckIllegalCharacters(String[] str, Boolean onlyCheckExtras)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
at System.Web.InternalSecurityPermissions.PathDiscovery(String path)
at System.Web.HttpRuntime.get_CodegenDir()
似乎.NET 4.6.2是罪魁祸首。
比较FileIOPermission in 4.6.2和FileIOPermission in 4.6.1 - 它们显然改变了非法路径检查,因此在无效路径上抛出ArgumentException的FileIOPermission构造函数的contract被破坏。