为什么我无法在网页上访问我的数据库?

时间:2015-07-05 22:06:28

标签: asp.net sql-server permissions web-config

我的网络项目出错了。我有一个aspx网站,其中有一个页面,我用它来查看个人黑胶唱片集的数据库。我使用visual studio 2013 Professional来创建整个站点和数据库。当我在Chrome测试浏览器中运行项目时,它运行得非常好,但是当我发布它并在合法的Web浏览器上运行它时,我得到以下错误。我试过谷歌搜索问题,然后空了。有人能指出我需要去的方向吗?我是否需要更改web.config文件中的访问权限或信任级别?我究竟会在配置文件中添加什么内容?

link:http://gipetransmissions.com/DBWebPage.aspx

配置文件:

<?xml version="1.0"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>

    <connectionStrings>
        <add name="ConnectionString" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\JWVinylDB.mdf;Integrated Security=True"
            providerName="System.Data.SqlClient" />
    </connectionStrings>
    <system.web>

      <customErrors mode="Off"/>
      <compilation debug="true" targetFramework="4.5" />
      <httpRuntime targetFramework="4.5" />
    </system.web>

</configuration>

ERROR:

  

&#39; /&#39;中的服务器错误应用。安全例外说明:   应用程序试图执行不允许的操作   安全政策。授予此应用程序所需的权限   请联系您的系统管理员或更改应用程序   配置文件中的信任级别。例外细节:   System.Security.SecurityException:请求失败。来源错误:[没有   相关源代码]源文件:App_Web_ahkwuo05.2.cs行:0   堆栈跟踪:[SecurityException:请求失败。]   System.Security.CodeAccessSecurityEngine.Check(对象需求,   StackCrawlMark&安培; stackMark,Boolean isPermSet)+0   System.Security.CodeAccessSecurityEngine.Check(PermissionSet permSet,   StackCrawlMark&安培; stackMark)+31 System.Security.PermissionSet.Demand()   +68 System.Data.LocalDBAPI.DemandLocalDBPermissions()+241 System.Data.LocalDBAPI.CreateLocalDBInstance(String instance)+32   System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo,   SqlInternalConnectionTds connHandler,Boolean ignoreSniOpenTimeout,   Int64 timerExpire,布尔加密,布尔值trustServerCert,布尔值   integratedSecurity,Boolean withFailover)+5308411   System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo   serverInfo,String newPassword,SecureString newSecurePassword,   Boolean ignoreSniOpenTimeout,TimeoutTimer timeout,Boolean   withFailover)+145   System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo   serverInfo,String newPassword,SecureString newSecurePassword,   Boolean redirectedUserInstance,SqlConnectionString connectionOptions,   SqlCredential凭证,TimeoutTimer超时)+262   System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer   timeout,SqlConnectionString connectionOptions,SqlCredential   credential,String newPassword,SecureString newSecurePassword,   Boolean redirectedUserInstance)+307   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity   identity,SqlConnectionString connectionOptions,SqlCredential   凭证,Object providerInfo,String newPassword,SecureString   newSecurePassword,Boolean redirectedUserInstance,SqlConnectionString   userConnectionOptions)+434   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions   options,DbConnectionPoolKey poolKey,Object poolGroupProviderInfo,   DbConnectionPool池,DbConnection owningConnection,   DbConnectionOptions userOptions)+225   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(类DBConnectionPool   pool,DbConnectionOptions选项,DbConnectionPoolKey poolKey,   DbConnectionOptions userOptions)+37   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionOptions   userOptions)+321   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnectionOptions   userOptions)+67   System.Data.ProviderBase.DbConnectionPool.TryGetConnection(的DbConnection   owningObject,UInt32 waitForMultipleObjectsTimeout,Boolean   allowCreate,Boolean onlyOneCheckConnection,DbConnectionOptions   userOptions,DbConnectionInternal&amp;连接)+1052   System.Data.ProviderBase.DbConnectionPool.TryGetConnection(的DbConnection   owningObject,TaskCompletionSource1 retry,DbConnectionOptions   userOptions,DbConnectionInternal&amp;连接)+78   System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(的DbConnection   owningConnection,TaskCompletionSource1重试,DbConnectionOptions   userOptions,DbConnectionInternal&amp;连接)+167   System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(的DbConnection   outerConnection,DbConnectionFactory connectionFactory,   TaskCompletionSource1 retry,DbConnectionOptions userOptions)+143   System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1   重试)+83 System.Data.SqlClient.SqlConnection.Open()+96   System.Data.Common.DbDataAdapter.FillInternal(DataSet数据集,   DataTable [] datatables,Int32 startRecord,Int32 maxRecords,String   srcTable,IDbCommand命令,CommandBehavior行为)+121   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet,Int32   startRecord,Int32 maxRecords,String srcTable,IDbCommand命令,   CommandBehavior行为)+316   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet,String   srcTable)+86   System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments   参数)+1482   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments   参数,DataSourceViewSelectCallback回调)+21   System.Web.UI.WebControls.DataBoundControl.PerformSelect()+138   System.Web.UI.WebControls.BaseDataBoundControl.DataBind()+30   System.Web.UI.WebControls.GridView.DataBind()+ 4   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()+ 105   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls()   +75 System.Web.UI.Control.EnsureChildControls()+83 System.Web.UI.Control.PreRenderRecursiveInternal()+ 42   System.Web.UI.Control.PreRenderRecursiveInternal()+155   System.Web.UI.Control.PreRenderRecursiveInternal()+155   System.Web.UI.Page.ProcessRequestMain(布尔   includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint)   +6704 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint)   +245 System.Web.UI.Page.ProcessRequest()+72 System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)+21   System.Web.UI.Page.ProcessRequest(HttpContext context)+58   ASP.dbwebpage_aspx.ProcessRequest(HttpContext context)中   App_Web_ahkwuo05.2.cs:0   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()   +341 System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean&amp; completedSynchronously)+69版本信息:Microsoft   .NET Framework版本:4.0.30319; ASP.NET版本:4.0.30319.34249

1 个答案:

答案 0 :(得分:1)