Difficulties Deploying to IIS from VSTS #1216

Closed
opened 2025-08-09 17:19:18 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @rgamage on 12/1/2016

Firstly, thank you so much for all your work in this area. It seems like you are the one of the very few folks blazing a path into this mysterious unknown, but exciting, area. I can't wait till it's all stable, but in the meantime...

I'm having trouble deploying from our on-premises VSTS build/release system to an on-premises IIS server. I can run the app fine locally.

I have met the pre-reqs:

  • VS 2015
  • .NET CORE 1.0.1
  • .NET CORE 1.0.1 Tools Preview 2
  • Node 4.5.0
  • IIS 8.5.9 on WS 2012 R2

I created my project from the template extension, then made the following changes:

  • Added ref to webpack-node-externals (NOTE - your blog article has this incorrectly described as "webpack-dev-externals"
  • Added .tfignore to exclude all dist/* files except the placeholder
  • Added placeholder to node_modules folder, and .tfignore entry
  • Added event-source-polyfill to get HMR working in IE 11

Created a build definition in the VSTS system that does these steps:

  1. dotnet restore (if I don't do this, it complains there is a missing .lock file - please do a dotnet restore)
  2. dotnet publish -c release -o $(Build.StagingDirectory)\publish-temp\WebApp
  3. publish build artifacts, from $(Build.StagingDirectory)\publish-temp to drop

Created a release definition that does this:

msdeploy -verb:sync -source:iisapp=$(System.DefaultWorkingDirectory)\$(sourcePath) -dest:iisapp=$(destApp-DEV),computerName=$(computerName-DEV) -enableRule:AppOffline

`This system is modeled after some other working .NET CORE apps we have, but those apps do not use Node on the server.

The error message I get is:

System.Exception
Call to Node module failed with error: Webpack dev middleware failed because of an error while loading 'aspnet-webpack'. Error was: Error: Cannot find module 'aspnet-webpack'
 at Function.Module._resolveFilename (module.js:325:15)
 at Function.Module._load (module.js:276:25)
 at Module.require (module.js:353:17)

To attempt to resolve this error, I commented out the "app.UseWebpackDevMiddleware" in statup.cs, which was getting run since this web server is our "Development" server (so env = Development). I figured we could safely disable this for remote deployment since it's mainly used for local debugging. After making this change, I got another error:

An unhandled exception occurred while processing the request.

Exception: Call to Node module failed with error: Prerendering failed because of error: Error: Cannot find module '@angular/compiler'
 at Function.Module._resolveFilename (module.js:325:15)
 at Function.Module._load (module.js:276:25)
 at Module.require (module.js:353:17)
 at require (internal/module.js:12:17)
 at Object.<anonymous> (C:\Web\Template-DEV\node_modules\angular2-universal\node_modules\angular2-platform-node\__private_imports__.js:4:18)
 at Module._compile (module.js:409:26)
 at Object.Module._extensions..js (module.js:416:10)
 at Module.load (module.js:343:32)
 at Function.Module._load (module.js:300:12)
 at Module.require (module.js:353:17)
 at require (internal/module.js:12:17)
 Current directory is: C:\Web\Template-DEV

Just as a test, on the web server in the app directory I did an npm install @angular/compiler. After that, I get this error:

System.Exception
Call to Node module failed with error: Error: Cannot find module 'C:\Web\Template-DEV\webpack.config.js'
at Function.Module._resolveFilename (module.js:325:15)
at Function.require.resolve (internal/module.js:16:19)
at Object.requireNewCopy (C:\Web\Template-DEV\node_modules\aspnet-webpack\RequireNewCopy.js:6:34)
at createWebpackDevServer (C:\Web\Template-DEV\node_modules\aspnet-webpack\WebpackDevMiddleware.js:133:47)
at createWebpackDevServer (C:\Windows\TEMP\tmpFA3A.tmp:74:50)
at C:\Windows\TEMP\tmpFB25.tmp:113:19
at IncomingMessage.<anonymous> (C:\Windows\TEMP\tmpFB25.tmp:132:38)
at emitNone (events.js:67:13)
at IncomingMessage.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:921:12)

Is there something I'm missing in my approach to deploying this application to an IIS server?

Thanks,
Randy

*Originally created by @rgamage on 12/1/2016* Firstly, thank you so much for all your work in this area. It seems like you are the one of the very few folks blazing a path into this mysterious unknown, but exciting, area. I can't wait till it's all stable, but in the meantime... I'm having trouble deploying from our on-premises VSTS build/release system to an on-premises IIS server. I can run the app fine locally. I have met the pre-reqs: * VS 2015 * .NET CORE 1.0.1 * .NET CORE 1.0.1 Tools Preview 2 * Node 4.5.0 * IIS 8.5.9 on WS 2012 R2 I created my project from the template extension, then made the following changes: * Added ref to webpack-node-externals (NOTE - your blog article has this incorrectly described as "webpack-dev-externals" * Added .tfignore to exclude all dist/* files except the placeholder * Added placeholder to node_modules folder, and .tfignore entry * Added event-source-polyfill to get HMR working in IE 11 Created a build definition in the VSTS system that does these steps: 1) dotnet restore (if I don't do this, it complains there is a missing .lock file - please do a dotnet restore) 2) dotnet publish -c release -o $(Build.StagingDirectory)\publish-temp\WebApp 3) publish build artifacts, from $(Build.StagingDirectory)\publish-temp to drop Created a release definition that does this: `msdeploy -verb:sync -source:iisapp=$(System.DefaultWorkingDirectory)\$(sourcePath) -dest:iisapp=$(destApp-DEV),computerName=$(computerName-DEV) -enableRule:AppOffline ` `This system is modeled after some other working .NET CORE apps we have, but those apps do not use Node on the server. The error message I get is: ``` System.Exception Call to Node module failed with error: Webpack dev middleware failed because of an error while loading 'aspnet-webpack'. Error was: Error: Cannot find module 'aspnet-webpack' at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load (module.js:276:25) at Module.require (module.js:353:17) ``` To attempt to resolve this error, I commented out the "app.UseWebpackDevMiddleware" in statup.cs, which was getting run since this web server is our "Development" server (so env = Development). I figured we could safely disable this for remote deployment since it's mainly used for local debugging. After making this change, I got another error: An unhandled exception occurred while processing the request. ``` Exception: Call to Node module failed with error: Prerendering failed because of error: Error: Cannot find module '@angular/compiler' at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load (module.js:276:25) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object.<anonymous> (C:\Web\Template-DEV\node_modules\angular2-universal\node_modules\angular2-platform-node\__private_imports__.js:4:18) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17) Current directory is: C:\Web\Template-DEV ``` Just as a test, on the web server in the app directory I did an npm install @angular/compiler. After that, I get this error: ``` System.Exception Call to Node module failed with error: Error: Cannot find module 'C:\Web\Template-DEV\webpack.config.js' at Function.Module._resolveFilename (module.js:325:15) at Function.require.resolve (internal/module.js:16:19) at Object.requireNewCopy (C:\Web\Template-DEV\node_modules\aspnet-webpack\RequireNewCopy.js:6:34) at createWebpackDevServer (C:\Web\Template-DEV\node_modules\aspnet-webpack\WebpackDevMiddleware.js:133:47) at createWebpackDevServer (C:\Windows\TEMP\tmpFA3A.tmp:74:50) at C:\Windows\TEMP\tmpFB25.tmp:113:19 at IncomingMessage.<anonymous> (C:\Windows\TEMP\tmpFB25.tmp:132:38) at emitNone (events.js:67:13) at IncomingMessage.emit (events.js:166:7) at endReadableNT (_stream_readable.js:921:12) ``` Is there something I'm missing in my approach to deploying this application to an IIS server? Thanks, Randy
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#1216
No description provided.