This page lists problems that often occur when Visual Studio deploys ASP. NET programs. For each error, the possible causes and solutions are listed.
When SQL Server Compact is used, Access is Denied
Scenario
After the SQL Server Compact database is used to deploy the site, the following error occurs on the running page:
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED ))
Cause and Solution
The network service account on the server needs to read the SQL Service Compact native Library (\ amd64 or bin \ x86 directory), but does not have the permission to read the folder. View how to grant permissions to the bin directory in the previous section (ensure that sub-directories have the same permissions ).
Unable to read the configuration file due to insufficient Permissions
Scenario
When you use the Visual Studio release button to deploy a program, the following error message appears in the Output window:
An error occurred when reading the IIS Configuration File 'machine/redirection'. The identity authentication Ming this operation was... Error: Cannot read configuration file due to insufficient permissions.
Cause and Solution
To publish with one-click, you must run Visual Studio as an administrator. Disable Visual Studio and run Visual Studio again as an administrator.
Cannot connect to the target server
Scenario
When you use the Visual Studio release button to deploy a program, the following error message appears in the Output window:
Web deployment task failed. (cocould not connect to the destination computer ("<server URL>") using the specified process
("The Web Management Service"). This can happen if a proxy server is interrupting communication with the destination server.
Disable the proxy server and try again ..)... The remote server returned an error: (502) Bad Gateway.
Cause and Solution
It may be a proxy server problem. Solution: Open the control panel orInternet Options, SelectConnectionTab, inInternet propertiesClickLAN Settings, InLAN SettingsIn the dialog box, cancelAutomatic Detection settings. And then release again.
If the problem persists, contact your administrator to see what changes can be made to the proxy and firewall, because Web Deploy uses an nonstandard port (8172) for the Web Management Service ), other Web Deploy connections use port 80. Web Management Service is generally used when deployed to a third-party host.
The default. Net application pool does not exist.
Scenario
When you deploy the. NET Framework 4 program, the following error message is displayed:
The default. NET 4.0 application pool does not exist or the application cocould not be added. Please verify that ASP. NET 4.0 is installed on this machine.
Cause and Solution
ASP. NET4 is not installed on IIS. If the deployed server is your development server (VS2010 is installed), ASP. NET4 is already installed on the server, but not on IIS. To successfully deploy the service, run the following Command in the Command Prompt window to install ASP. NET4 in IIS:
cd %windir%\Microsoft.NET\Framework\v4.0.30319aspnet_regiis.exe –iru
You also need to set the. NET framework version for the default application pool. For detailed steps, see Chapter 5th.
Format of the initialization string does not conform to specification starting at index 0
Scenario
After publishing with one-click, the following error occurs when you access the page (you need to read the database:
Format of the initialization string does not conform to specification starting at index 0.
Cause and Solution
Open the deployment siteWeb. configFile to see if the database connection string starts with $ (ReplacableToken _, as shown below:
<connectionStrings> <add name="DefaultConnection" connectionString="$(ReplacableToken_DefaultConnection-Web.config Connection String_0)" providerName="System.Data.SqlServerCe.4.0"/> <add name="SchoolContext" connectionString="$(ReplacableToken_SchoolContext-Web.config Connection String_0)" providerName="System.Data.SqlServerCe.4.0"/></connectionStrings>
If it is the same as above, you need to edit the project file and add the following attributes to PropertyGroup:
<AutoParameterizationWebConfigConnectionStrings>False</AutoParameterizationWebConfigConnectionStrings>
Then redeploy
HTTP 500.21 Internal Server Error
Scenario
After running the deployed site, the following error message is displayed:
HTTP Error 500.21-Internal Server Error. Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list.
Cause and Solution
ASP. NET4 is required for the program, but ASP. NET4 is not registered on IIS. To register ASP. NET4, run the following code in Command Prompt:
cd %windir%\Microsoft.NET\Framework\v4.0.30319aspnet_regiis.exe –iru
You also need to set the. NET framework version for the default application pool. For detailed steps, see Chapter 5th.
You cannot open the SQL Server Express database in the App_Data directory.
Scenario
To connect to the SQL Server Express database (. mdf file) under the App_Data directory, Web. config sets the connection string. the following error occurs when the program is run for the first time:
System. Data. SqlClient. SqlException: Cannot open database "DatabaseName" requested by the login. The login failed.
Cause and Solution
No SQL Server Express database named this name can be found on the Server (even if a file with the same name has been deleted before). The solution is to give it. rename the mdf file with a name that has never been used before, and then modifyWeb. configThe connection string in the file.
Model Compatibility Cannot be Checked
Scenario
To connect to the SQL Server Express database (. mdf file) under the App_Data directory, Web. config sets the connection string. the following error occurs when the program is run for the first time:
Model compatibility cannot be checked because the database does not contain model metadata. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions.
Cause and Solution
The existing database name once exists on the local machine and may contain tables and data. If you have SQL Server Management Studio (SSMS), you can delete it through it, if you do not ask your database to get a name that has never been used before, and then modifyWeb. configThe connection string in the file.
An SQL Error occurs when the User and Role are created.
Scenario
The following error occurs when the script is supported:
The approximate location of the error was between lines '1' and '3' of the script.
The verbose log may have more information about the error. The command started:
Create user [user2] for login [user2] WITH DEFAULT
Error: User does not have permission to perform this action.
Cause and Solution
The account that runs the SQL script does not have the permission. It is generally provided to the db_datareader, db_datawriter, and db_ddladmin roles. Although most database objects can be created, users and Role cannot be created. To avoid this problem, add the following attributes to the ProSource element of the script automatically generated by the database:
CopyAllUsers=false, CopyAllRoles=false
Edit the PreSource element in the project file. See Edit Deployment Settings in the Project File. If the User and Role in your development library need to be deployed in the target library, contact your provider.
An SQL timeout error occurs when you deploy and run a custom script.
Scenario
A timeout error occurs when running the Custom Script:
Cause and Solution
If multiple scripts are run in different transactions, the scripts automatically generated by default are in one transaction, but the custom scripts are not, if you choosePackage/Publish SQLTabPull data and/or schema from an existing databaseTo add a custom SQL script, you must set transaction settings on some scripts. For details, see: How to: Deploy a Database With a Web Application Project.
Stream Data of Site Manifest Is Not Yet Available
Scenario
When you use the deploy. cmd file to install the package under the t (Test) option, the following error occurs:
Error: The stream data of 'sitemanifest/dbFullSql [@ path = 'C: \ TEMP \ AdventureWorksGrant. SQL ']/sqlscript' is not yet available.
Cause and Solution
This command cannot generate test report. If you enter the y option in the command line, it may be okay. Note: This error message only appears in Test mode.
The program requires ManagedRuntimeVersion v4.0
Scenario
The following error occurs during deployment attempt:
The application pool that you are trying to use has the 'managedruntimeversion' property set to 'v2. 0'. This application requires 'v4. 0 '.
Cause and Solution
ASP. NET4 is not installed on IIS. If the deployed server is your development server (VS2010 is installed), ASP. NET4 is already installed on the server, but not on IIS. To successfully deploy the service, run the following Command in the Command Prompt window to install ASP. NET4 in IIS:
cd %windir%\Microsoft.NET\Framework\v4.0.30319aspnet_regiis.exe –i
Cannot convert Microsoft. Web. Deployment. DeploymentProviderOptions
Scenario
When deploying a package, the following error occurs:
Unable to cast object of type 'Microsoft. Web. Deployment. deploymentprovideroptions' to 'Microsoft. Web. Deployment. deploymentprovideroptions '.
Cause and Solution
When you use Web Deploy 1.1 UI deployment from IIS Manager, Web Deploy 2.0 is also installed on it. If you useIIS Remote Administration ToolTo import and deploy a package, and check after connectionNew Features AvailableDialog box. (The dialog box may only appear during the first connection. If you want to appear each time, close IIS Manager and enable it again through inetmgr/reset ). IfWeb Deploy UIIf a Feature version is earlier than 8, Web Deploy 1.1 and 2.0 versions may be installed on the deployed server. If the client version is 2.0, then, only Web Deploy 2.0 should be installed on the server. You can contact the provider to solve the problem.
Cannot load SQL Server Compact components
Scenario
The following error occurs when running the deployed site:
Unable to load the native components of SQL Server Compact corresponding to the ADO. NET provider of version 8482. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details.
Cause and Solution
The Bin directory does not contain the amd64 and x86 subdirectories of the native assembly. On a computer that has, if SQL Server Compact is installed On the computer, the native assembly is stored in C: \ Program Files \ Microsoft SQL Server Compact Edition \ v4.0 \ Private directory. The best solution is to install the NuGet SqlServerCompact package in Visual Studio. The package has a script that can copy the native assembly to the amd64 and x86 subdirectories. Of course, you can also copy it manually. For more information, see section 2nd
From Uncle Tom