SYMPTOMS
Sitebuilder shows "Site cannot be published." or "Location status: static-only".
CAUSE
Sitebuilder have specific requirements for the location, where site is published. All requirements are described in "Administator's Guide" document, items: "Setting Up and Maintaining Sitebuilder / Specifiying Hosts Used for Publishing Sites / Requirements for Hosts". If these requirements are not satisfied, Sitebuilder shows "Site cannot be published" error message. Checking these requirements is essential and complex task for even senior administrators.RESOLUTION
1. Read carefully Sitebuilder publishing error additional information, shown at Wizard / Publish page after clicking on "Publish" button;If this does not help to understand the issue, please do:
2. Check Sitebuilder log file. It can be accessed via Administrator's Panel / Server / Logs or at %SB_DIR%\_logs\application.log, where %SB_DIR% - folder, where Sitebuilder has been installed. Records in log file can give you specific on what requirements are not meet.
If this does not help to understand the issue, please do:
3. Create verify.aspx file at publishing location working directory, having the following content:
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Net.Mail" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Xml.Serialization" %>
<%@ Import Namespace="System.Security" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Collections.Specialized" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.Security.Permissions" %>
<%@ Import Namespace="System.Drawing.Printing" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Sitebuilder for Windows. Verify Publishing Location</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table border="1">
<tr>
<td>
Verify Status:
</td>
<td>
<asp:Label ID="LabelStatus" runat="server"></asp:Label>
</td>
</tr>
</table>
<br />
Errors: <asp:Label ID="LabelErrorsCount" runat="server"></asp:Label>
<asp:Repeater runat="server" ID="RepeaterErrors">
<HeaderTemplate>
<table border="1">
<tr>
<td>
Error kind
</td>
<td>
Description
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr><td><%# DataBinder.Eval(Container.DataItem,"ErrorKind")%></td>
<td><%# DataBinder.Eval(Container.DataItem,"Description")%></td></tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
</form>
</body>
</html>
<script runat="server" language="C#">
private Version NET_VERSION = new Version(2, 0, 50727, 0);
protected void Page_Load(object sender, EventArgs e)
{
bool isGoodNetVersion = true;
bool isApplicationRoot = true;
if (Environment.Version < NET_VERSION)
{
isGoodNetVersion = false;
}
string a = Server.MapPath("~");
a = a.EndsWith("\\") ? a : a + "\\";
string b = Server.MapPath(".");
b = b.EndsWith("\\") ? b : b + "\\";
if (0 != string.Compare(a, b, true, System.Globalization.CultureInfo.InvariantCulture))
{
isApplicationRoot = false;
}
if (!isGoodNetVersion)
{
AddError(VerifyErrorKind.BadNetVersion, string.Format("Current .NET version: . Version must be greater or equal than ", Environment.Version.ToString(), NET_VERSION.ToString()));
}
if (!isApplicationRoot)
AddError(VerifyErrorKind.NotApplicationRoot);
bool isSuccess = isApplicationRoot && isGoodNetVersion;
if (isSuccess)
{
VerifyApplication(Context);
isSuccess = errors.Count == 0;
}
LabelStatus.Text = isSuccess?"Dynamic":"Static";
LabelErrorsCount.Text = errors.Count.ToString();
if (errors.Count > 0)
{
RepeaterErrors.DataSource = errors;
RepeaterErrors.DataBind();
}
}
public enum VerifyErrorKind
{
UnknownError,
BadNetVersion,
NotApplicationRoot,
TrustLevelLessThanMedium,
WebPermissionDenied,
TempCreateDirDenied,
TempCreateFileDenied,
AppDataDoesntExist,
WritePermissionDenied,
ReadPermissionDenied,
DeletePermissionDenied,
DbWritePermissionDenied,
DbReadPermissionDenied,
OleDbError,
OleDbPermissionDenied,
};
private ArrayList errors = new ArrayList();
private void AddError(VerifyErrorKind errorKind, string description)
{
errors.Add(new Error(errorKind, description));
}
private void AddError(VerifyErrorKind errorKind)
{
errors.Add(new Error(errorKind, ""));
}
private void VerifyApplication(HttpContext context)
{
try
{
CheckState checkState = new CheckState(context);
if (!Directory.Exists(context.Server.MapPath(CheckState.APPDATA_FOLDER)))
{
checkState.AddError(VerifyErrorKind.AppDataDoesntExist);
}
else
{
CheckFilePermissions checkFilePerm = new CheckFilePermissions();
CheckOleDb checkOleDb = new CheckOleDb();
CheckSiteBuilderMdb checkSiteBuilderMdb = new CheckSiteBuilderMdb();
CheckCodeAccessPermissions checkCodeAcessPerm = new CheckCodeAccessPermissions();
checkCodeAcessPerm.ProcessRequest(checkState);
if (checkState.Errors.Count == 0)
{
checkFilePerm.SetSuccessor(checkOleDb);
checkOleDb.SetSuccessor(checkSiteBuilderMdb);
checkFilePerm.ProcessRequest(checkState);
}
}
errors.AddRange(checkState.Errors);
}
catch (Exception unknownExc)
{
AddError(VerifyErrorKind.UnknownError, unknownExc.ToString());
}
}
internal class CheckState
{
public const string APPDATA_FOLDER = "~/App_Data";
private HttpContext context;
private ArrayList errors = new ArrayList();
public HttpContext Context
{
get
{
return this.context;
}
set
{
this.context = value;
}
}
public ArrayList Errors
{
get
{
return this.errors;
}
}
public CheckState(HttpContext context)
{
this.context = context;
}
public void AddError(VerifyErrorKind errorKind, string description)
{
errors.Add(new Error(errorKind, description));
}
public void AddError(VerifyErrorKind errorKind)
{
errors.Add(new Error(errorKind, ""));
}
}
internal abstract class CheckTask
{
protected CheckTask successor;
public void SetSuccessor(CheckTask successor)
{
this.successor = successor;
}
public abstract void ProcessRequest(CheckState state);
}
internal class CheckFilePermissions : CheckTask
{
public override void ProcessRequest(CheckState state)
{
string uniqueId = state.Context.Request["uniqueId"];
string testFileName = state.Context.Server.MapPath(
string.Format("/test", CheckState.APPDATA_FOLDER, uniqueId));
string fileName = Guid.NewGuid().ToString();
fileName = state.Context.Server.MapPath(string.Format("/", CheckState.APPDATA_FOLDER, fileName));
try
{
using (FileStream fc = File.Create(fileName))
{
}
;
try
{
using (FileStream fsw = File.OpenWrite(fileName))
{
}
;
using (FileStream fswt = File.OpenWrite(testFileName))
{
}
;
}
catch (UnauthorizedAccessException)
{
state.AddError(VerifyErrorKind.WritePermissionDenied);
}
try
{
using (FileStream fsr = File.OpenRead(fileName))
{
}
;
using (FileStream fsrt = File.OpenWrite(testFileName))
{
}
;
}
catch (UnauthorizedAccessException)
{
state.AddError(VerifyErrorKind.ReadPermissionDenied);
}
}
catch (UnauthorizedAccessException)
{
state.AddError(VerifyErrorKind.WritePermissionDenied);
}
try
{
File.Delete(fileName);
File.Delete(testFileName);
}
catch (UnauthorizedAccessException)
{
state.AddError(VerifyErrorKind.DeletePermissionDenied);
}
if (successor != null)
{
successor.ProcessRequest(state);
}
}
}
internal class CheckOleDb : CheckTask
{
public override void ProcessRequest(CheckState state)
{
//connect to not existed db
string connString = string.Format("provider=Microsoft.Jet.OLEDB.4.0;Data Source=",
state.Context.Server.MapPath(string.Format("/.mdb", CheckState.APPDATA_FOLDER, Guid.NewGuid())));
OleDbConnection conn = new OleDbConnection(connString);
try
{
conn.Open();
}
catch (SecurityException)
{
state.AddError(VerifyErrorKind.OleDbPermissionDenied);
}
catch (Exception e)
{
bool isExpected = false;
if (e is OleDbException)
{
OleDbException oleDbExc = (OleDbException)e;
if (oleDbExc.Errors.Count > 0)
{
OleDbError err = oleDbExc.Errors[0];
if (err.NativeError == -534578963)
isExpected = true;
}
}
if (!isExpected)
{
state.AddError(VerifyErrorKind.OleDbError);
}
}
if (successor != null)
{
successor.ProcessRequest(state);
}
}
}
internal class CheckSiteBuilderMdb : CheckTask
{
public override void ProcessRequest(CheckState state)
{
string dbPath = state.Context.Server.MapPath(string.Format("/sitebuilder.mdb", CheckState.APPDATA_FOLDER));
bool dbExists = File.Exists(dbPath);
if (dbExists)
{
try
{
using (FileStream fsr = File.OpenRead(dbPath))
{
}
;
}
catch (UnauthorizedAccessException)
{
state.AddError(VerifyErrorKind.DbReadPermissionDenied);
}
try
{
using (FileStream fsw = File.OpenWrite(dbPath))
{
}
;
}
catch (UnauthorizedAccessException)
{
state.AddError(VerifyErrorKind.DbWritePermissionDenied);
}
}
if (successor != null)
{
successor.ProcessRequest(state);
}
}
}
internal class CheckCodeAccessPermissions : CheckTask
{
public override void ProcessRequest(CheckState state)
{
ArrayList descriptions = new ArrayList();
AspNetHostingPermission ahp = new AspNetHostingPermission(AspNetHostingPermissionLevel.Medium);
try
{
ahp.Demand();
}
catch (SecurityException)
{
descriptions.Add("AspNetHostingPermission");
}
DnsPermission dp = new DnsPermission(PermissionState.Unrestricted);
try
{
dp.Demand();
}
catch (SecurityException)
{
descriptions.Add("DnsPermission");
}
EnvironmentPermission ep = new EnvironmentPermission(EnvironmentPermissionAccess.Read, "TEMP;TMP;USERNAME;OS;COMPUTERNAME");
try
{
ep.Demand();
}
catch (SecurityException)
{
descriptions.Add("EnvironmentPermission");
}
FileIOPermission fp = new FileIOPermission(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read | FileIOPermissionAccess.Append | FileIOPermissionAccess.PathDiscovery,
state.Context.Server.MapPath("~"));
try
{
fp.Demand();
}
catch (SecurityException)
{
descriptions.Add("FileIOPermission");
}
IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission(PermissionState.None);
isfp.UserQuota = 9223372036854775807;
isfp.UsageAllowed = IsolatedStorageContainment.AssemblyIsolationByUser;
try
{
isfp.Demand();
}
catch (SecurityException)
{
descriptions.Add("IsolatedStorageFilePermission");
}
PrintingPermission pp = new PrintingPermission(PrintingPermissionLevel.DefaultPrinting);
try
{
pp.Demand();
}
catch (SecurityException)
{
descriptions.Add("PrintingPermission");
}
SecurityPermission sp = new SecurityPermission(
SecurityPermissionFlag.Assertion | SecurityPermissionFlag.Execution | SecurityPermissionFlag.ControlThread | SecurityPermissionFlag.ControlPrincipal | SecurityPermissionFlag.RemotingConfiguration);
try
{
sp.Demand();
}
catch (SecurityException)
{
descriptions.Add("SecurityPermission");
}
SmtpPermission smp = new SmtpPermission(SmtpAccess.Connect);
try
{
smp.Demand();
}
catch (SecurityException)
{
descriptions.Add("SmtpPermission");
}
SqlClientPermission scp = new SqlClientPermission(PermissionState.Unrestricted);
try
{
scp.Demand();
}
catch (SecurityException)
{
descriptions.Add("SqlClientPermission");
}
//string[] descArray = new string[] { };
//descriptions.CopyTo(descArray, 0);
string[] descArray = descriptions.ToArray(typeof(string)) as string[];
if (descriptions.Count > 0)
{
state.AddError(VerifyErrorKind.TrustLevelLessThanMedium, string.Join(", ", descArray));
}
WebPermission wp = new WebPermission(PermissionState.Unrestricted);
try
{
wp.Demand();
}
catch (SecurityException)
{
state.AddError(VerifyErrorKind.WebPermissionDenied);
}
if (successor != null)
{
successor.ProcessRequest(state);
}
}
}
[Serializable]
new public class Error
{
private VerifyErrorKind errorKind;
private string description;
public VerifyErrorKind ErrorKind
{
get
{
return this.errorKind;
}
//need for serialization
set
{
this.errorKind = value;
}
}
public string Description
{
get
{
return this.description;
}
//need for serialization
set
{
this.description = value;
}
}
public Error() { }
public Error(VerifyErrorKind errorKind)
{
this.errorKind = errorKind;
this.description = string.Empty;
}
public Error(VerifyErrorKind errorKind, string description)
{
this.errorKind = errorKind;
this.description = description;
}
}
</script>
Make HTTP request to publishing location Web Site URL adding verify.aspx, for example, to http://sitebuildersite.com/verify.aspx
Check returned responce and table below:
N Error Explanation Action 1 HTTP Error 404 ASP.NET is not installed or registered Install dotnetfx, aspnet_regiis –i in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727, inetmgr->web service extensions->asp.net 2.0.50727->allow 2 HTTP Error 403.1 - Forbidden: Execute access is denied May be It should has the Scripting permissions enabled in IIS metabase inetmgr->site->properties->virtual directory tab->execute permission combobox, change ‘None’ to ‘Scripts only’ 3 Server Error ‘Compilation Error’
Compiler Error Message: CS0234: The type or namespace name 'Mail' does not exist in the class or namespace 'System.Net' (are you missing an assembly reference?) Asp.net version must be greater or equal than 2.0.50727.0 See 1 4 Server Error ‘Compilation Error’
Compiler Error Message: CS0016: Could not write to output file 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\vt\ebf24440\13ec26b0\App_Web_verify.aspx.cdcab7d2.br6bk6kz.dll' -- 'Access is denied. ' - %WinDir%\temp – must have ‘Full Control’ permissions for Application Pool identity (NETWORK SERVICE by default). %WinDir%\temp – by default, may be other dir, for actual path see http://msdn2.microsoft.com/en-us/library/aa364992.aspx, In Microsoft Windows Explorer, locate the %windir%\temp directory.
2. Right-click %windir%\temp, and then click Properties.
3. In the Properties window, click the Security tab.
4.Click Add, type ServerName\ NETWORK SERVICE, and then click OK.
Note Replace ServerName with the name of the Web server.
Note Replace NETWORK SERVICE to the account, under which the corresponding Application Pool is being run
5.Under Allow, click to select the Full Control check box, and then click OK. 5 “Server Application Unavailable” and error in application log (my computer->manage->system tools->event viewer->application) “It is not possible to run two different versions of ASP.NET in the same IIS process. Please use the IIS Administration Tool to reconfigure your server to run the application in a separate process.” Application pool, to which this application is assigned, must contain no ASP.NET 1.1 applications Remove asp.net 1.1 applications from application pool 5 Server Error
“Debugging is not supported under current trust level settings. “Servers used for publishing sites must work at least in the Medium Trust mode. special .config file web_medium_sb_trust.config in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\
Web.config:
<location allowOverride="true">
<system.web>
<securityPolicy>
<trustLevel name="Full" policyFile="internal" />
<trustLevel name="High" policyFile="web_hightrust.config" />
<trustLevel name="Medium" policyFile="web_mediumtrust.config" />
<trustLevel name="MediumSiteBuilder" policyFile="web_medium_sb_trust.config" />
<trustLevel name="Low" policyFile="web_lowtrust.config" />
<trustLevel name="Minimal" policyFile="web_minimaltrust.config" />
</securityPolicy>
<trust level="Full" originUrl="" />
</system.web>
</location>
<location path="Default Web Site/test" allowOverride="false">
<system.web>
<trust level="MediumSiteBuilder" />
</system.web>
</location>
----
Path in location – site
---
web_medium_sb_trust.config – copy of web_mediumtrust.config plus
<IPermission class="OleDbPermission" version="1" Unrestricted="true" />
<IPermission class="WebPermission" version="1" Unrestricted="true" />
7 Server Error SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
<IPermission class="AspNetHostingPermission" version="1"
Level="Low" /> See previous 8 Server Error
Execution permission cannot be acquired <IPermission class="IsolatedStorageFilePermission" version="1"
Allowed="AssemblyIsolationByUser"
UserQuota="9223372036854775808" /> See previous 9 Server errorFailed to grant permission to execute No <IPermission class="SecurityPermission" See previous 10 Server error No <IPermission See previous 11 BadNetVersion Asp.net version must be greater or equal than 2.0.50727.0 See 1 12 NotApplicationRoot Site should be an IIS Application (plain Virtual Folder won't work) inetmgr->site->properties-> virtual directory tab ->application name->create button 13 AppDataDoesntExist create App_Data folder in publishing location 14 ReadPermissionDenied,
WritePermissionDenied,
DeletePermissionDenied the App_Data folder it should be read\write\delete-accessible to the account, under which the corresponding Application Pool is being run In Microsoft Windows Explorer, locate the App_Data directory. 2. Right-click App_Data, and then click Properties.3. In the Properties window, click the Security tab. 4.Click Add, type ServerName\ NETWORK SERVICE, and then click OK.
Note Replace ServerName with the name of the Web server. Note Replace NETWORK SERVICE to the account, under which the corresponding Application Pool is being run
5.Under Allow, click to select the Full Control check box, and then click OK. 15 TrustLevelLessThanMedium Servers used for publishing sites must work at least in the Medium Trust mode. See 6 16 DbWritePermissionDenied, DbReadPermissionDenied the sitebuilder.mdb file it should be read\write -accessible to the account, under which the corresponding Application Pool is being run 17 OleDbError OLE DB Provider isn`t installed or works incorrectly 18 OleDbPermissionDenied Request for the permission OleDbPermission failed See 6 19 WebPermissionDenied
Request for the permission WebPermission failed See 6