System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermi

本文介绍了解决在IIS7上安装myLittleAdmin时出现的安全异常问题,通过设置应用程序池的“LoadUserProfile”为true来修复错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

f you're getting this error when installing myLittleAdmin on IIS7:

Code:
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.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.


Change your application pool setting "Load User Profile" to true.



For those of you using myLittleAdmin from Plesk Install :

"Load user profile" must be true for "Plesk (Defaul)t (2.0) (Pool)"




 

Application: ASD880.exe CoreCLR Version: 9.0.24.52809 .NET Version: 9.0.0 Description: The process was terminated due to an unhandled exception. Exception Info: System.UnauthorizedAccessException: Access to the path is denied. at ASD880.View.SerialPortCommunication.SendDataAsync(Byte[] data) in C:\Users\asd\Desktop\充电头网PD31\ASD880\Page Navigation App\View\Communication.xaml.cs:line 59 at ASD880.View.BatteryMode.executePipeline(JArray jsonArray, Boolean PipeResult, Int32 frequency) in C:\Users\asd\Desktop\充电头网PD31\ASD880\Page Navigation App\View\BatteryMode.xaml.cs:line 1407 at ASD880.View.BatteryMode.ProjectStart_Click(Object sender, RoutedEventArgs e) in C:\Users\asd\Desktop\充电头网PD31\ASD880\Page Navigation App\View\BatteryMode.xaml.cs:line 890 at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at ASD880.App.Main() 分析错误
06-18
package com.example.text; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.media.projection.MediaProjectionManager; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.provider.Settings; import android.util.Log; import android.view.View; import android.widget.Button; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import com.example.text.AI.FloatingBallService; import com.example.text.Class.goods; import com.example.text.SQL.DatabaseHelper; import com.example.text.SQL.Goods.Goods; import com.example.text.SQL.Goods.GoodsItem; import com.example.text.utils.Http; import java.io.IOException; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import okhttp3.Call; import okhttp3.Callback; import okhttp3.Response; import android.Manifest; import android.widget.Toast; public class MainActivity extends AppCompatActivity { private static final int REQUEST_STORAGE_PERMISSION = 1; private DatabaseHelper dbHelper; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // EdgeToEdge.enable(this); setContentView(R.layout.activity_main); // 检查存储权限 if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { // 权限未开启,请求用户授权 ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_STORAGE_PERMISSION); } else { // 权限已开启,继续执行创建数据库的操作 createDatabase(); } if (!Settings.canDrawOverlays(this)) { Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName())); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); return; // 如果没有权限,直接退出服务 } //创建数据库 dbHelper = new DatabaseHelper(this); Intent captureIntent = ((MediaProjectionManager) getSystemService(Context.MEDIA_PROJECTION_SERVICE)) .createScreenCaptureIntent(); startActivityForResult(captureIntent, 101); Button button=findViewById(R.id.button2); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (Settings.canDrawOverlays(MainActivity.this)) { startService(new Intent(MainActivity.this, FloatingBallService.class)); // ✅ 自动退到后台(模拟 Home 键) Intent homeIntent = new Intent(Intent.ACTION_MAIN); homeIntent.addCategory(Intent.CATEGORY_HOME); homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(homeIntent); } else { // 引导用户授权 Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName())); startActivity(intent); } } }); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == 101 && resultCode == RESULT_OK) { Intent service = new Intent(this, FloatingBallService.class); service.putExtra("code", resultCode); service.putExtra("data", data); startService(service); } } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (requestCode == REQUEST_STORAGE_PERMISSION) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { // 用户授予了权限,继续执行创建数据库的操作 createDatabase(); } else { // 用户拒绝了权限,提示用户 Log.e("MainActivity", "存储权限被拒绝"); Toast.makeText(this, "存储权限被拒绝,无法继续操作", Toast.LENGTH_SHORT).show(); } } } private void createDatabase() { // 创建数据库 dbHelper = new DatabaseHelper(this); Log.d("MainActivity", "数据库创建成功"); } } 2025-07-18 09:17:38.018 2569-2630 MiEvent system_server E report:open miev fail, EventId 901003004 -t 1752801458 -paraList {"ActivityName":"com.example.text.MainActivity","Duration":10126,"PackageName":"com.example.text"} ---------------------------- PROCESS ENDED (10638) for package com.example.text ---------------------------- 2025-07-18 09:17:40.058 4285-5371 ActivityManagerWrapper com.miui.home E getRecentTasks: mainTaskId=10275 userId=0 windowMode=1 baseIntent=Intent { act=android.intent.action.MAIN flag=270532608 cmp=ComponentInfo{com.example.text/com.example.text.MainActivity} } 2025-07-18 09:17:40.416 1425-1425 vendor.qti...al-service ven...qti.hardware.perf-hal-service E ExtendedPerfBoost: extended_perfboost_verification() 738: Ok, set boost params. hintid=4225 hinttype=1 prio=3, clientpid=2569 packagename=com.example.text params=boost:1 cpu0:1804800 cpu4:2496000 cpu7:2592000 cpumask:ff 2025-07-18 09:17:40.459 10872-10872 Zygote usap64 E process_name_ptr:10872 com.example.text 2025-07-18 09:17:40.523 27603-3228 SuggestManager com.miui.securitycenter.remote E openApp name = com.example.text 2025-07-18 09:17:40.534 27603-28288 AntiFraud com.miui.securitycenter.remote E hookDetectUnsafeAppStart error, android.content.pm.PackageManager$NameNotFoundException: com.example.text at android.app.ApplicationPackageManager.getApplicationInfoAsUser(ApplicationPackageManager.java:515) at android.app.ApplicationPackageManager.getApplicationInfo(ApplicationPackageManager.java:498) at android.app.ApplicationPackageManager.getApplicationInfo(ApplicationPackageManager.java:492) at w2.b.f(Unknown Source:12) at w2.b$c.onForegroundInfoChanged(Unknown Source:21) at com.miui.gamebooster.mutiwindow.b$a.onForegroundInfoChanged(Unknown Source:152) at miui.process.IForegroundInfoListener$Stub.onTransact(IForegroundInfoListener.java:86) at android.os.Binder.execTransactInternal(Binder.java:1351) at android.os.Binder.execTransact(Binder.java:1282) 2025-07-18 09:17:40.546 8279-10833 SuggestManager com.miui.securitycenter.remote E openApp name = com.example.text 2025-07-18 09:17:40.549 4285-5371 ActivityManagerWrapper com.miui.home E getRecentTasks: mainTaskId=10276 userId=0 windowMode=1 baseIntent=Intent { act=android.intent.action.MAIN flag=268435456 cmp=ComponentInfo{com.example.text/com.example.text.MainActivity} } ---------------------------- PROCESS STARTED (10872) for package com.example.text ----------------------------
最新发布
07-19
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值