Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Classic pipeline mode #789

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/IISExpress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import { v4 as uuidv4 } from 'uuid';
import * as iconv from 'iconv-lite';
import TelemetryReporter from 'vscode-extension-telemetry';


export interface IExpressArguments {
path: string;
port: number;
clr: settings.clrVersion;
protocol: settings.protocolType;
pipelineMode?: settings.pipelineMode; // New property for pipeline mode
}

export class IISExpress {
Expand Down Expand Up @@ -65,7 +65,10 @@ export class IISExpress {
clr: options.clr ? options.clr : settings.clrVersion.v40,

// If no protocol set fallback to http as opposed to https
protocol: options.protocol ? options.protocol : settings.protocolType.http
protocol: options.protocol ? options.protocol : settings.protocolType.http,

// Pipeline mode, default to Integrated if not set
pipelineMode: options.pipelineMode ? options.pipelineMode : settings.pipelineMode.Integrated
};


Expand Down Expand Up @@ -112,8 +115,13 @@ export class IISExpress {
this._reporter.sendTelemetryException(error, {"appCmdPath": this._iisAppCmdPath, "appCmd": `add site -name:${siteName} -bindings:${this._args.protocol}://localhost:${this._args.port} -physicalPath:${this._args.path}`});
}

// Based on the CLR chosen use the correct built in AppPools shipping with IISExpress
const appPool = this._args.clr === settings.clrVersion.v40 ? "Clr4IntegratedAppPool" : "Clr2IntegratedAppPool";
// Determine the application pool based on CLR version and pipeline mode
let appPool = "";
if (this._args.pipelineMode === settings.pipelineMode.Integrated) {
appPool = this._args.clr === settings.clrVersion.v40 ? "Clr4IntegratedAppPool" : "Clr2IntegratedAppPool";
} else {
appPool = this._args.clr === settings.clrVersion.v40 ? "Clr4ClassicAppPool" : "Clr2ClassicAppPool";
}

// Assign the apppool to the site
// appcmd set app /app.name:Site-Staging-201ec232-2906-4052-a431-727ec57b5b2e/ /applicationPool:Clr2IntegratedAppPool
Expand Down
13 changes: 12 additions & 1 deletion src/iisexpress-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
"http",
"https"
]
},
"pipelineMode": {
"enum": [
"Integrated",
"Classic"
],
"description": "This property allows you to set the pipeline mode for the application pool."
}
},
"type": "object",
Expand All @@ -39,9 +46,13 @@
"$ref": "#/definitions/protocol",
"title": "Protocol",
"description": "This property is optional & allows you to set http or https"
},
"pipelineMode": {
"$ref": "#/definitions/pipelineMode",
"description": "This property allows you to set the pipeline mode for the application pool."
}
},
"required": [
"port"
]
}
}
10 changes: 8 additions & 2 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ export interface Isettings {
url?: string;
clr: clrVersion;
protocol: protocolType;
pipelineMode?: pipelineMode; // New property for pipeline mode
}

export enum clrVersion {
v40 = <any>"v4.0",
v20 = <any>"v2.0"
}

export enum pipelineMode {
Integrated = <any>"Integrated",
Classic = <any>"Classic" // New enum value for Classic pipeline mode
}

export enum protocolType {
http = <any>"http",
Expand Down Expand Up @@ -45,7 +50,8 @@ export function getSettings(uri:vscode.Uri| undefined):Isettings{
port : getRandomPort(),
path: './',
clr: clrVersion.v40,
protocol: protocolType.http
protocol: protocolType.http,
pipelineMode: pipelineMode.Integrated // Default to Integrated if not set
};

let settings:Isettings;
Expand Down Expand Up @@ -127,4 +133,4 @@ export function getSettings(uri:vscode.Uri| undefined):Isettings{
// http://www.iis.net/learn/extensions/using-iis-express/running-iis-express-without-administrative-privileges
export function getRandomPort():number{
return util.getRandomIntInclusive(1024,44399);
}
}
Loading