My blog has moved! Redirecting…

You should be automatically redirected. If not, visit http://www.digitalfugu.com/blog/ and update your bookmarks.

Showing posts with label Debugging. Show all posts
Showing posts with label Debugging. Show all posts

Tuesday, October 02, 2007

Install A .Net Service Via Command Line

I've been working with .Net services for the last year or so and it is often convenient for debugging to be able to install your debug version. For us we have a number of services that interact with each other. So we install the service we aren't working on, but that the one we are working depends on, and debug using the IDE. Since it is a major pain to build an installer every time we want to test, we used the command line utility InstallUtil.exe that comes with the .Net Framework to install and uninstall our services in batch files.

If you've installed .Net in the default location InstallUtil.exe lives in C:\Windows\Microsoft.Net\Framework\v2.0.50727\InstallUtil.exe
in the respective framework version directory.

Below is an example batch file.
C:\Windows\Microsoft.Net\Framework\v2.0.50727\InstallUtil.exe C:\Dev\Server\SourceCode\bin\Debug\server_service.exe
pause
and to uninstall, use the /u flag
C:\Windows\Microsoft.Net\Framework\v2.0.50727\InstallUtil.exe /u C:\Dev\Server\SourceCode\bin\Debug\server_service.exe
pause
Using these batch files we just create short cuts to them and can double click the short cut to install or uninstall. Of course you can install/uninstall more than one service in the batch file.

Be sure to also check out the other flags available for InstallUtil.

Friday, May 25, 2007

Access ASP.Net Web Service test pages remotely

I strongly dislike having to RDP into our webserver, thereby tying up an RDP session (only 2 in remote admin mode), to test webservices via the automatically generated test pages to debut whether our app is consuming the data wrong, or the web services are returning the wrong data.

If security is not a concern then you can enable the HTTP-POST and HTTP-GET protocols so that you can get to the test pages remotely not having to be localhost.

From MSDN:

HTTP GET and HTTP POST may be enabled by editing the Web.config file for the vroot where the Web service resides. The following configuration enables both HTTP GET and HTTP POST:

<configuration>
<system.web>
<webservices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webservices>
</system.web>
</configuration>

Alternatively, you can enable these protocols for all Web services on the computer by editing the section in Machine.config. The following example enables HTTP GET, HTTP POST, and also SOAP and HTTP POST from localhost:

<protocols>
<add name="HttpSoap"/>
<add name="HttpPost"/>
<add name="HttpGet"/>
<add name="HttpPostLocalhost"/>
<!-- Documentation enables the documentation/test pages -->
<add name="Documentation"/>
</protocols>