I have two projects developed with C#, .NET in VS 2010: One is an ASP.NET web application and the second one is a C# Windows service that runs as a local system. The web application is installed and run on the same physical machine via IIS.
My question is, how to get the path to my web application installation folder on this machine from the service?
I assume your are using IIS 7.5 and you know web application name. If so you can use ServerManager from Microsoft.Web.Administration assembly to get the physical path.
Here is link on how to user the class ServerManager How to get site's physical path on disk?
Related
When I click on the Publish method following options show up:
What is the significance of each method?
Web Deploy - If you have IIS on server machine running and configured to receive Web Deploy requests, it will send all requested by IIS files. IIS will immediately start running new web page.
Web Deploy Package - If you have IIS on server machine running and configured to receive a Web Deploy Package it will pack your whole web page, and will upload them to server machine. IIS will immediately start running new web page.
FTP will upload files to FTP server (can be any OS that handles FTP), but be aware that this is NOT safe and whole upload process can be captured and compromised.
File system will deploy all items required for launching a web service, with any method supported by current project configuration, into provided directory on your machine.
Web Deploy:
Deploys your app to a local or remote IIS server immediately (one click publishing), assuming you have access and the server is configured properly.
Web Deploy Package:
Similar to Web Deploy, but creates a zipped deployment package on the local file system to be deployed later to a local or remote IIS server.
FTP:
Copies the required app files to an FTP server. You might use this to deploy your app to the (non-Azure) cloud.
File System:
Copies the required app files to the local file system. Useful for testing or if you want more control over how the deployment is done.
The two web deploy methods are smarter than the more old-school FTP/file system approaches. For example, they can apply config file transforms during the deployment, and they are faster because they only transfer changes. They are also more secure.
More info here.
I want to explore a folder of a network drive(\11.11.11.11\Shared) that is share to all user within network. I have hosted my application into IIS of my local machine that is also in the same network.
We have to only explore the folder of like we done using Run Command and putting the address.
It will work when I run the application though visual studio. But if host the published code into IIS then it will not work.
I am always getting the success response in both the cases(on IIS as well as Visual Studio running mode).
In IIS create web application.
Assign app pool of your choice to application.
Under web application add virtual directory and map network folder to this virtual directory.
Give read/list permissions on your network folder to app pool's identity.
Set directory browsing on web application.
I have created asmx web service in PC1. Now I have coped this project to some other PC2. I have installed only IIS Express and .NET Framework.
I want to run web service in PC2 using IIS Express. Is it possible or not?
Thanks!!
Under the IIS Express folder in the C:\Program (x86) folder there's the appcmd.exe. First you need to add a virtual directory with the follwoing command:
appcmd add vdir /app.name:<site_name>/ /path:/<virtual_directory> /physicalPath:<physical_location>
If there is no site you can add one by yourself:
appcmd add site /name:SITENAME /id:2 /physicalPath:C:\PHYSICAL_PATH /bindings:http/*:8080
If you want to install the Service on the Default Web Site (if there is one) you can use the following:
vdir /app.name:"Default Web Site"/ /path:/service /physicalPath:C:\PHYSICAL_PATH
Yes possible.
Steps for check:
Whether that system is connected with LAN.
You have to Set the IP address for PC2 in Edit Bindings(IIS)
I have developed a restful web service using ASP.NET, and while using the Visual Studio environment, it worked like a charm with IIS Express. The service itself is a complementary feature and will have to run on every machine on which our product is installed.
I have therefore created a new directory webservice, which holds the web.config and the Global.asax file, as well as a directory bin, which holds the RestulWebservice.dll file.
I then have setup a new web page on the IIS, rooting at C:\inetpub\wwwroot. The web page itself is hosting a web application, based in C:\inetpub\wwwroot\RestfulWebservice (which holds the files described above).
However, if I startup the IIS and visit http://localhost:80/RestfulWebservice, all I am getting is an error 403.14, stating that I may not inspect the contents of this folder unless I allow IIS to do so. If I choose to allow this, I am simply presented with the contents of the folder, not the service itself.
If I try to access a resource of the restful web service directly (i.e. http://localhost:80/RestfulWebservice/Home, I get a direct 404.0 error, telling me that the resource does not exist)
What am I doing wrong here, it can impossibly be this hard to get a compiled library ASP.NET web service to run on the IIS, it works like a charm on IIS express.
c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
I am using VS2008 C# and testing on my local XP Pro PC with local IIS, I have wrote a web service to call a third party software .exe file to use svn checkout commands to insert data into a folder, which use System.Diagnostics.Process.Start . The same codes did work when I use VS2008 build-in ASP.NET Development Server(http://localhost:2999/MyServices/MyServices.asmx). but when I use IIS normal URL(http://developer/MyServices/MyServices.asmx) to run Process.Start on the web service, it just haunlted and not doing anything.plz send one sample program.
This is most likely down to the user being used to run the code. When using the built-in server, it is running as the same user as Visual Studio is running as. When in IIS, it will be running as the MACHINENAME\ASPNET user.
If the process you are starting cannot execute as the MACHINENAME\ASPNET user, it will not work when hosted in IIS unless you change your configuration to change the user it runs as. See this page for more info on what users are used for what in IIS.