我在aspx.cs中完成了一切正常工作的项目。现在是时候看到光,时间发布了。
我还有一个包含数据库“db / database.accdb”
的文件夹然而,在发布之前,我需要在web.config中添加一个“连接字符串”到BD Access,以便能够修改(如果需要)而无需重新编译应用程序。
这就是我在web.config文件中的内容
<configuration>
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<authentication mode="Windows">
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/>
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/>
</providers>
</roleManager>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<system.web>
<identity impersonate="false"/>
<!-- falso para ISS-->
</system.web>
<system.web>
<authorization> <!-- windows authorization IIS EXPRESS (F4) ENABLE senão dá erro -->
<deny users = "?" /> <!-- nega acesso utilizadores anónimos -->
<allow users ="*" /> <!-- dá acesso a todos os utilizadores -->
</authorization>
</system.web>
</configuration>