You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

SQL与IIS权限问题:移除db_owner后下拉列表无法显示

Fixing Read-Only Access for IIS App Account (testB) Without db_owner

Got it, let's work through this problem step by step. The core issue here is that your IIS site's testB account needs just enough permissions to pull data for that dropdown list, without the over-privileged db_owner role. Here's how to lock this down properly:

1. Ensure Basic Database Connectivity First

First, make sure testB can actually connect to your target database. If you haven't already mapped the login to the database user, do that and grant connect permissions:

-- Switch to your target database
USE YourDatabaseName;
-- Create user if not already mapped to the login
CREATE USER testB FOR LOGIN testB;
-- Grant permission to connect to the database
GRANT CONNECT TO testB;

2. Grant Select Permissions for Required Data

The dropdown is pulling data from specific tables or views—you need to give testB SELECT access to exactly those objects.

If you know exactly which tables/views the dropdown relies on:

GRANT SELECT ON dbo.YourDropdownTable1 TO testB;
GRANT SELECT ON dbo.YourDropdownView1 TO testB;
-- Repeat this line for every table/view the dropdown uses

Option B: Grant access to all user tables in a schema

If your dropdown pulls from multiple tables in the same schema (like dbo) and you're comfortable with that scope:

GRANT SELECT ON SCHEMA::dbo TO testB;

3. Check for Hidden Dependencies

Sometimes apps need more than just basic SELECT to function:

  • If your dropdown uses a stored procedure to fetch data, grant execute access to that proc:
    GRANT EXECUTE ON dbo.YourDropdownStoredProc TO testB;
    
  • If your app queries system views (for example, to check table metadata, though this is less common for simple dropdowns), you might need:
    GRANT VIEW DEFINITION TO testB;
    -- Or narrow it to specific system views if needed
    GRANT SELECT ON sys.tables TO testB;
    

4. Test the Setup

After applying these permissions, test the IIS site with testB. If the dropdown still doesn't load, run a SQL trace or check the app's error logs to see exactly which queries are failing—this will point you to any missing permissions you need to add.

Remember: Stick to the principle of least privilege—only grant the exact permissions testB needs to do its job, no more. This keeps your database secure while letting the app function as intended.

内容的提问来源于stack exchange,提问作者deepti

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 08:59:21