First I'd like to apologize for posting on a topic that has been covered several times on these forums, but I've tried a variety of fixes throughout the week and at this point I'm running out of time.
I followed Beth's instructions (Deployment Guide: How to Configure a Web Server to Host LightSwitch Applications) for setting up the IIS Server and deploying the application. I acutally did this twice: once with an existing server and one with a fresh, new one I provisioned because I was getting this error and I assumed it had to do with some pre-existing configuration. Unfortunately that didn't help, as the same error returned:
Error 2 Web deployment task failed. ((12/21/2012 9:30:41 AM) An error occurred when the request was processed on the remote computer.)
(12/21/2012 9:30:41 AM) An error occurred when the request was processed on the remote computer.
The entry type 'Unknown' was not expected at this time. The serialization stream may be corrupted. C:\Program Files\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets 4377 6 appname
I have tried the following:
- Turning off Windows Firewall on the servers (no difference so I turned them back on)
- Verifying IIS configuration on web server (as described in Beth's post) - looks ok (again, fresh install followed by web platform installer seemed to do the job)... still no go (with the above error)
- Finally, Un-checked "IIS Server has the prerequisites installed":
This resulted in the deployment succeeding, but the application wouldn't work (said web.config was corrupt or something). I adjusted the authentication settings for the site (in IIS) and now it runs; however, it gives the message "An error occurred while communicating with the database." and then says the application failed to load. Since the application works fine in debug mode in Visual Studio, I assume this has to do with the configuration of the application pool in IIS... or something.
I was about to start fiddling around with IIS again, but I'd really prefer to let Lightswitch do the work if possible, because I want to be able to publish updates without going through this trouble again. This assumes that those things (authentication settings and configuration of the application pool so it works with the database) are supposed to be handled by the Lightswitch publishing wizard... is that correct?
So, any more tips on "Web deployment task failed" problem? I'm kind of at a loss since it's literally a fresh install of Windows Server (2008 R2 with IIS 7).
Here are some additional details:
- The lightswitch "Access Control" settings for the application are set to "Use Windows authentication" and "Allow only users and Active Directory Security groups specified in the Users screen of the application."
In the publish Wizard:
- Application type = "Web"
- IIS Server (reqrequisites installed = checked)
- "Remotely Publish to a server now" - username/password are for a Domain Admin
- no HTTPS
- Database connection works (SQL user with dbowner, and datareader/datawriter for the database)
- Publish database schema = no (I was working against the live data... no changes needed)
That's all that seems relevant. Thanks in advance for any assistance :)
Well, it still won't deploy with that box checked, but I got past the "An error occurred while communicating with the database." Turns out not allowing it to deploy/update the database scheme one time resulted in there being no tables to store the rolepermissions and aspnet_roles and whatnot... dumb mistake on my part.
Anyway I ran the publish wizard again with the deploy schema optoin selected (gave it the "sa" user on the databse for that, which I temporarilly activated and then deactivated again... don't want to lead any other readers to be throwing sa credentials around), and now the application runs and accepts the Windows authentication.
This thread was useful in understanding what Lightswitch is doing with the various credentials when it publishes the application: Huh? - "An error occurred while communicating with the database" after latest update to working application