web deploy 401 from package, works in VS2010 - asp.net

I'm trying to get an automated deployment working from a CI server (TFS 2010)
Basically I've got a package getting built and if all the tests past I'd like to deploy it.
Outside of TFS and just using the visual studio command line, I navigate to the folder location of the package and use the following:
C:\site\Package>site.deploy.cmd /Y
/M:"https://WebServer:8172/MsDeploy.axd" -allowUntrusted /U:username
/P:password /A:Basic
Where in this case the user is a domain user with full permissions on the destination website folder. When I run this I get a 401 unauthorized error. I've created an IIS Manager and set up the permissions for the network service account on the destination files too but that also gives the same error.
The frustrating point is that from the VS 2010 right mouse click publish page it works perfectly with either user. Does anyone have any ideas. I've been all over stack overflow and I'm certain that the folder permissions are correct and that IIS is configured correctly. The fact that VS 2010 can publish with the same credentials backs that up for me.
I did see that you can pass ?site=SiteName when specifying the server but I just get errors about not expecting that parameter.
Looking at the site.deploy.cmd and site.SetParameters.xml it appears that it certainly looks likes it's going for Web Deploy 2 and that the configuration settings have been correctly grabbed from the config transform.
Thanks

If it's a non-admin user, you need to include the IIS site in the remote URL.
C:\site\Package>site.deploy.cmd /Y /M:"https://WebServer:8172/MsDeploy.axd?site=Website Name" -allowUntrusted /U:username /P:password /A:Basic
It's possible the generated cmd file does this for you, but only when you supply a certain argument.

http://www.jrjlee.com/2011/12/deploying-web-packages-as-non.html
this may work. append your site name with querystring to your url

Related

Start an ASP.net website from a specific folder using IIS Express via command line

I've written and ASP.net MVC web application that needs to be installed as a "normal" application (or as close to it as possible). By which I mean, I need to have a "double click on exe file and the webappp opens in default browser" behavior, or as close to that as possible.
Being used to Java, I stupidly thought that I could use and embedded webserver to run it, but after a bit of research (correct me if I'm wrong here) it seems this cannot be done (only ASP.net Core can do that, but I'm using the traditional .NET Framework) and the web app needs to be run in either IIS or IIS Express.
So, after more research, this page:
https://learn.microsoft.com/en-us/iis/extensions/using-iis-express/running-iis-express-from-the-command-line
seems to suggest that launching a site from a specific folder via IIS Express is possible, by using a command like:
iisexpress.exe /path:"C:\Program Files\MyWebsite\bin"
where the path above contains my compiled ASP.net MVC website.
This, however, doesn't seem to work. When I issue that command I get the following output:
c:\Program Files\IIS Express>iisexpress.exe /path:"C:\Program Files\MyWebsite\bin"
Copied template config file 'c:\Program Files\IIS Express\AppServer\applicationhost.config' to 'C:\Users\MyUser\AppData\Local\Temp\iisexpress\applicationhost20179188941639.config'
Updated configuration file 'C:\Users\MyUser\AppData\Local\Temp\iisexpress\applicationhost20179188941639.config' with given cmd line info.
Starting IIS Express ...
Successfully registered URL "http://localhost:8080/" for site "Development Web Site" application "/"
Registration completed
IIS Express is running.
Enter 'Q' to stop IIS Express
So basically IIS Express starts, but it's not running my website from the folder I specified, it runs some (presumebly) default empty website, called "Development Web Site". I checked some urls, and I can confirm that is not my website, but just an empty shell with no pages or anything else.
What am I missing here? How do you start a website in IIS Express via command line? Do I have to "register" the website first somehow?
EDIT:
After a bit more research, I found out I can register a website explicitly by doing:
appcmd.exe add site /name:MySite /physicalPath:"C:\Program Files\MyWebsite\bin" /bindings:http://localhost:8081
and then start it with:
iisexpress.exe /site:MySite
This however doesn't solve the problem: when I browse to the website via browser all I get are 404 errors, there's no content at all.
One thing I also must point out: since an ASP.net website is compiled into a DLL file, I don't understand how simpy registering/starting it using a path to a FOLDER would work... how would IIS Express understand which DLL to load the site from? Seems like there are some crucial pieces missing here...
After further tinkering, I figured it out. I was pointing to the /bin directory of the website. Instead, you have to point to the parent directory, the one that contains the Web.config file.
So, in my case, I changed:
iisexpress.exe /path:"C:\Program Files\MyWebsite\bin"
to:
iisexpress.exe /path:"C:\Program Files\MyWebsite"
and now it works correctly

HTTP Error 500.19 - Internal Server Error 0x80070003 Cannot read configuration file

I'm getting the above error when I publish my application and move it from development to production server. Below are the error details.
Detailed Error Information
Module IIS Web Core
Notification BeginRequest
Handler Not yet determined
Error Code 0x80070003
Config Error Cannot read configuration file
Config File \?\C:\inetpub\wwwroot\WorkmenCompTest\web.config
Requested URL http://localhost:80/wictest
Physical Path C:\inetpub\wwwroot\WorkmenCompTest
Logon Method Not yet determined
Logon User Not yet determined
This website used to work previously but recently the published version stopped working due to this error. As far as I can tell, the only change was installing iTextSharp and iTextSharp xmlworker through nuget.
I have tried, without success:
giving modify permission on the site folder to Everyone
checking the web.config file, and using an older version of the web.config file (from when the site worked).
uninstalling iTextSharp and iTextSharp XMLWorker
The project still runs without issue from Visual Studio.
This is solved. The error was caused by the folder name not matching the path for the virtual directory. Oh wow I feel dumb.
Check the applicationhost.config file under - .vs\lpsWeb-UI\config folder of your application root.
Under sites section of the config file check what the physical path points to.
If you modify those you should be able to fix the issue.
This is because of different physical path in the IIS.To change the physical path of application content
You can perform this procedure by using the user interface (UI), by running Appcmd.exe commands in a command-line window, by editing configuration files directly, or by writing WMI scripts.
User Interface
To use the UI
Open IIS Manager. For information about opening IIS Manager, see Open IIS Manager (IIS 7).
In the Connections pane, expand the Sites node and click to select the site in which your application runs.
In the Actions pane, click View Applications.
On the Applications feature page, select an application from the list and then click Basic Settings in the Actions pane.
In the Physical path box, change the path of the application content.
Click OK.
DefaultAppPool application pool runs under the Network Service account. This account is local to the computer and this account does not exist on another computer. Make sure that you configure the DefaultAppPool application pool to use an account that is a domain user. Then, you can use the same account on the WorkmenComp file server. Alternatively, you can create a workgroup account on the WorkmenComp file server.
I am getting this HTTP Error 500.19 error when I am giving physical path as Z:\App_Live in IIS
Instead of using z:\ ,
I used network path \\server\share\live_folder in the IIS physical path – something like this \\server\share\wwwroot\inetpub\wwwroot
Also you may need to specify username/password in "connect as".

asp.net web forms -- 404 on publish

I'm having some issues getting my project to publish to a server for work.
we don't have a folder shared to the project directory or a FTP server setup so in order to publish I have to publish it locally, remote into the server, then copy/paste the project files into the desired location.
I have done this plenty of times before with no issues but for some reason it is not working for me now. Every time i go to the site I get a HTTP 404
One weird thing that I noticed is in IIS when i click on 'basic settings' the virtual path is set as /portalDEV/Apps, alias is UA, and physical path is D:\websites\portalDEV\Apps\UA, When i click on 'test settings' i get an error saying invalid application path.
Any ideas? Please let me know if you need anymore information.
On your server IIS you must create virtual path who link physical path of your application.
You set an alias
You set the directory of your application
In the end of treatment your check the framework version section

running webservice from IIS

Hello I am very new to creating webservice in .net.
I had created one webservice in .net It has by default one webmethod HelloWorld and another one is add method which i had created. Then i had build that webservice.
Now at second phase I had installed IIS
Then In Administrator tools--> IIS manager--> default website by right clicking i had created a virtual directory named as "trial" with path given of my webservice with all permissions.
my service has named as service.asmx.
Now the problem is when i right click on that service.asmx and browse it . it is showing me error such as
You are not authorized to view this page
You do not have permission to view this directory or page using the credentials you supplied.
I had also tried of checking that "enable anonymous access " and also tried by uncheckable it but it doesn't work.
Even if I had also tried of checking Integrated windows authentication and also tried to unchecked it but it also doesn't work now I am bit tired of it .
I can't understand why it does not give me rights to run that web service from IIS
that web service can be run perfectly from studio 2008.
Please give me suggestions to run it.
First of all can you please include your Web.config file? Also, did you make sure to set up permissions for the folder you created with IIS Manager? Iwould check that first

Run ASP.NET website on local IIS

I'm running Win 7 and I'm trying to get a ASP.NET website, to run under the local IIS. I've set up a virtual directory which points to the folder where the website is. But when I access localhost/[VirtualDir] I get an error from IIS. The error is a 401.3 and relates to not having rights to access the folder (my error message is in danish, so posting the error won't help much...grrrr). I've given IIS_IUSRS full rights to the folder with the code, but I still get the same error.
I've also tried to create a new default website in VS and place it in wwwroot, but I still get the same error.
Anyone who can help?
Best regards,
Steffen Jorgensen
It is probably not the folder permission that are giving you the error, more likely it is the IIS authentication, below is a link with some steps to try.
http://www.bloggingdeveloper.com/post/HTTP-Error-4013-Unauthorized-Error-While-creating-IIS-70-web-site-on-Windows-Vista.aspx
have you told your project to use IIS in the project settings? The default is the special VS version of IIS (The name just escaped me), but if you'll go into Project Properties -> Web You'll see at the bottom that you want to change to "Use local IIS"

Resources