我在谷歌商店的应用程序崩溃报告中遇到了很多例外.有人能解释一下可能导致这种情况的原因吗?我使用的是android:targetSdkVersion = 19
java.lang.SecurityException: Requires READ_PHONE_STATE: Neither user 10131 nor current process has android.permission.READ_PHONE_STATE.
at android.os.Parcel.readException(Parcel.java:1546)
at android.os.Parcel.readException(Parcel.java:1499)
at com.android.vending.billing.IInAppBillingService$Stub$Proxy.getSkuDetails(IInAppBillingService.java:251)
at com.inapp.util.IabHelper.querySkuDetails(IabHelper.java:920)
at com.inapp.util.IabHelper.queryInventory(IabHelper.java:550)
at com.inapp.util.IabHelper.queryInventory(IabHelper.java:522)
at com.inapp.util.IabHelper$2.run(IabHelper.java:617)
at java.lang.Thread.run(Thread.java:818)
Run Code Online (Sandbox Code Playgroud) 我想从 Android 手机获取 Build.getSerial()。在 Android O 之前,我需要 Manifest.permission.READ_PHONE_STATE 权限。但是在 Android 10 中,我得到了上述异常。我所做的是将此权限添加到清单
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"
tools:ignore="ProtectedPermissions"/>
Run Code Online (Sandbox Code Playgroud)
在活动中我需要请求许可但没有这样的许可
ActivityCompat.requestPermissions(this@ListActivity,
arrayOf(Manifest.permission.READ_PHONE_STATE,
<<Manifest.permission.READ_PRIVILEGED_PHONE_STATE>>),
SERIAL_NUMBER_PERMISSION)
Run Code Online (Sandbox Code Playgroud)
那么如果我不能授予权限,我如何获得序列号..?我该怎么办?
我已经编写了3个ASP.net MVC Web应用程序,并且所有这些应用程序都部署在我的ISP的共享主机服务器上.
所有3个应用程序在配置和设置方面都非常相似.第一个应用程序部署到与第二个和第三个不同的服务器.第一个应用程序没有给我任何错误.
第二个和第三个应用程序稍微吐出以下SecurityException :随机:
替代文字http://i46.tinypic.com/24p9pac.jpg
例外文字:
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Configuration.ConfigurationPermission, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.
Source Error:
An unhandled exception was generated during the execution of the current web request. …Run Code Online (Sandbox Code Playgroud) asp.net asp.net-mvc log4net securityexception shared-hosting
今天,我在尝试远程调试为.NET 4.0运行时构建的应用程序时遇到了一个奇怪的问题.
应用程序驻留在网络共享上并由远程计算机执行.但是,由于System.Configuration.ConfigurationManager.GetSection()方法中的权限要求引发了SecurityException,因此应用程序在加载期间每次都会崩溃.我没有检查基类库中的其他权限要求是否也会导致安全性异常,但在所有情况下都不应该使用新的CLR.
应用程序以完全信任的方式运行(在调试时检查它,并且像往常一样,对于CLR 4.0中的Intranet应用程序必须始终如此)所以我很无能在这种情况下权限需求如何导致异常.当针对3.5 SP1运行时(默认情况下首次引入对网络共享应用程序的完全信任)构建时,每个运行都按预期运行.
我粘贴了下面的示例代码.任何帮助是极大的赞赏.
using System;
using System.Configuration;
namespace ConsoleApplication1
{
public sealed class AssetsSection : ConfigurationSection
{
private static readonly ConfigurationProperty s_propPath;
private static readonly ConfigurationPropertyCollection s_properties;
static AssetsSection()
{
s_propPath = new ConfigurationProperty("path", typeof(String));
s_properties = new ConfigurationPropertyCollection()
{
s_propPath
};
}
public static AssetsSection Get()
{
return (AssetsSection) ConfigurationManager.GetSection("test/assets");
}
protected override ConfigurationPropertyCollection Properties
{
get
{
return s_properties;
}
}
public String Path
{
get
{
return (String) base[s_propPath];
}
set
{
base[s_propPath] …Run Code Online (Sandbox Code Playgroud) 运行此程序时,我一直收到错误:出现类型为"System.Security.SecurityException"的未处理异常附加信息:必须将ECall方法打包到系统模块中.
class Program{
public static void Main()
{
Brekel_ProBody2_TCP_Streamer s = new Brekel_ProBody2_TCP_Streamer();
s.Start();
s.Update();
s.OnDisable();
}
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
布雷克尔图书馆的重要部分如下:
//======================================
// Connect to Brekel TCP network socket
//======================================
private bool Connect()
{
// try to connect to the Brekel Kinect Pro Body TCP network streaming port
try
{
// instantiate new TcpClient
client = new TcpClient(host, port);
// Start an asynchronous read invoking DoRead to avoid lagging the user interface.
client.GetStream().BeginRead(readBuffer, 0, READ_BUFFER_SIZE, new AsyncCallback(FetchFrame), null);
Debug.Log("Connected to Brekel …Run Code Online (Sandbox Code Playgroud) 我有一个我用一些业务逻辑创建的库,包括写一个System.Diagnostics.EventLog实例.该库通常从Windows服务应用程序调用,但现在我正在尝试从我的ASP.NET MVC应用程序调用这些相同的库函数.
我在我的控制器中尝试了这个代码来创建我传递给需要写入日志的方法的EventLog实例.
Dim log = New EventLog("Application", My.Computer.Name, "MyMVCApp")
Run Code Online (Sandbox Code Playgroud)
当库方法中的代码尝试写入日志时,会生成以下错误:
[SecurityException: Requested registry access is not allowed.]
System.ThrowHelper.ThrowSecurityException(ExceptionResource resource) +51
Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +7462217
System.Diagnostics.EventLog.CreateEventSource(EventSourceCreationData sourceData) +366
System.Diagnostics.EventLog.VerifyAndCreateSource(String sourceName, String currentMachineName) +194
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData) +205
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type) +14
Run Code Online (Sandbox Code Playgroud)
我的Web应用程序在运行IIS 6的Windows Server 2003上作为网络服务用户运行.为了使网络服务用户能够访问注册表,我需要做些什么吗?
有没有更好的方法来创建一个用于ASP.NET MVC应用程序的EventLog实例?是否已经由我需要引用的框架创建了一个?
我正在使用Ubuntu 14.04并安装了Derby 10.12.1.1.我已经按照Apache网站的安装说明进行操作.
我CLASSPATH被设定为
/usr/local/hadoop/lib/*:/usr/local/hive/lib/*:/usr/local/derby/lib/derbynet.jar:/usr/local/derby/lib/derbytools.jar
Run Code Online (Sandbox Code Playgroud)
当我尝试开始德比
hduser@HadoopMaster:/usr/local/derby/data$ /usr/local/derby/bin/startNetworkServer
Run Code Online (Sandbox Code Playgroud)
我明白了
Tue Nov 10 23:50:18 AEDT 2015 : Security manager installed using the Basic server security policy.
java.lang.SecurityException: sealing violation: package org.apache.derby.impl.services.timer is sealed
at java.net.URLClassLoader.getAndVerifyPackage(URLClassLoader.java:399)
at java.net.URLClassLoader.definePackageInternal(URLClassLoader.java:419)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:451)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at …Run Code Online (Sandbox Code Playgroud) 我正在使用NHibernate开发一个ASP.NET MVC应用程序,我正在尝试使用Automapper从发送到视图的DTO对象中隐藏Domain对象:
SessionFactory在我的项目中创建和工厂的类库我下载了AutoMapper来转换DTO中的Domain对象,并添加了代码来执行此操作Application_Start.
当我在VisualStudio中运行应用程序时(通过按F5),它工作正常,我的DTO映射到视图中.
当我在IIS中发布它时,我得到一个安全性异常:
Mapper.CreateMap<Category, CategoryDto>();
Mapper.CreateMap<Product, ProductDto>();
Run Code Online (Sandbox Code Playgroud)
System.Security.SecurityException:对类型'System.Security.Permissions.ReflectionPermission,mscorlib,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'的权限的请求失败.
如何在没有安全性异常的情况下使Automapper工作?
如何避免这种例外
E/AndroidRuntime(26113): Caused by: java.lang.SecurityException: No active admin owned by uid XXXX for policy #3
Run Code Online (Sandbox Code Playgroud)
在调用时:
public static void lockScreen(Context context) {
Log.d(TAG, "lockScreen");
ComponentName mDeviceAdminSample = null;
DevicePolicyManager dpm = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, mDeviceAdminSample);
dpm.lockNow();
}
Run Code Online (Sandbox Code Playgroud) 我想让谷歌应用程序结算服务工作.
我到目前为止服务已绑定并连接,但是一旦我尝试从服务中获取一些数据,它就会崩溃并记录日志:
Run Code Online (Sandbox Code Playgroud)
04-02 10:36:32.795 10569-10651/my.app.package E/IAP? java.lang.SecurityException: Binder invocation to an incorrect interface
at android.os.Parcel.readException(Parcel.java:1425)
at android.os.Parcel.readException(Parcel.java:1379)
at billing.IInAppBillingService$Stub$Proxy.getSkuDetails(IInAppBillingService.java:251)
at my.app.package.libs.clientbackend.iap.IAPHelper$FetchItemsCallable.call(IAPHelper.java:102)
at my.app.package.libs.clientbackend.iap.IAPHelper$FetchItemsCallable.call(IAPHelper.java:89)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:856)
到目前为止这是我的代码:
显示购买的活动:
Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
serviceIntent.setPackage("com.android.vending");
bindService(serviceIntent, this, Context.BIND_AUTO_CREATE);
Run Code Online (Sandbox Code Playgroud)
一旦服务连接,IAB就会调用:
Bundle itemBundle = new Bundle();
itemBundle.putStringArrayList("ITEM_ID_LIST", new ArrayList<>(Arrays.asList(itemIds)));
Bundle detailsBundle = service
.getSkuDetails(3, context.getPackageName(), "inapp", itemBundle);
Run Code Online (Sandbox Code Playgroud)
它在最后一行失败,...getSkuDetails(...上面发布了错误.
我对这个问题进行了一些研究,发现它可能是由错误的包名引起的.我已经包含了IInAppBillingService.aidl谷歌文档中描述的类似内容,但我在导入时仍然收到错误的包:
该文件位于: src/main/aidl/com/android/vending/billing/IInAppBillingService.aidl
但是当我导入生成的类时,Android Studio使用此导入路径:
import billing.IInAppBillingService;
Run Code Online (Sandbox Code Playgroud)
根据文档,这应该是:
import com.android.vending.billing.IInAppBillingService;
Run Code Online (Sandbox Code Playgroud)
我的项目设置还有问题,或者有人知道这个错误的原因吗?
非常感谢McFarlane