How to debug ASP.NET applications or Webservices in IIS

2

I need to debug my application that consumes a Webservice and would like to be able to debug Webservice in a Visual Studio window and the application in another, but I can not make local connection of the Android emulator to the local machine.

How can I debug Webservice being consumed on my own development machine or on a test server?

    
asked by anonymous 23.04.2015 / 13:36

1 answer

2

First, Webservice must be running on a local IIS. The Visual Studio development server does not allow remote connections, only local, and the Android emulator acts like another machine accessing the network.

Installing IIS on your machine

Windows 7 Home Premium, Home Basic, or Home Starter Machines

  • Ensure that your user is a member of the machine's admin group
  • Click Iniciar and Painel de Controle
  • In% with%, click% with% and% with%
  • In the Windows Features dialog box, click% with%
  • Make sure the options are checked: Painel de Controle , Programas and Ativar ou desativar recursos do Windows and then click Serviços de Informações da Internet .

Windows 8 and Windows 8.1 machines

  • Press Windows + R and type ASP.NET
  • Click% with%
  • In the Windows Features dialog box, click% with%
  • Make sure the options are checked: Recursos de Desenvolvimento de Aplicativos , Ferramentas de Gerenciamento da Web and OK and then click appwiz.cpl .

UsingthecommandpromptinWindows7,8,and8.1

Atthecommandprompt(pressWindows+RandtypeAtivarouDesativarrecursosdoWindows),entereverythingononeline:

start /w pkgmgr /l:log.etw /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures; IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors; IIS-HttpRedirect;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility; IIS-ASP;IIS-CGI;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes; IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor; IIS-HttpTracing;IIS-CustomLogging;IIS-Security;IIS-BasicAuthentication; IIS-URLAuthorization;IIS-RequestFiltering;IIS-IPSecurity;IIS-Performance; IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;IIS-WebServerManagementTools; IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService; IIS-IIS6ManagementCompatibility;IIS-Metabase;IIS-WMICompatibility;IIS-LegacyScripts; IIS-LegacySnapIn;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment; WAS-ConfigurationAPI

Enabling the ASP.NET project for debugging

  • In the project properties go Serviços de Informações da Internet and check the ASP.NET option and check Recursos de Desenvolvimento de Aplicativos Note: You may need to uncheck the option of Ferramentas de Gerenciamento da Web
  • No OK find element cmd.exe and add Debuggers
  • <configuration>
        ...
        <system.web>
            <compilation
                debug="true"
                ...
               >
                ...
            </compilation>
        </system.web>
    </configuration>
    

    Publishing the Project in IIS

    Creating the site to run the project

    • Run ASP.NET
      • Use Local IIS Server > IIS Express > web.config
      • Press Windows + R and type configuration/system.web/compilation
    • Set the default website by clicking debug="true" as the right-click option on the site
      • Type a description
      • Check the IIS Manager option for the IPs configuration
      • Modify the TCP port, if necessary
      • Click on the 'Home Directory' tab and specify a local directory for the site
      • Give read access to directory

    PublishingbyVisualStudio

    TopublishthesiteyouneedVisualStudiotosendthecompiled/processedfilestothefolderthatyoupreviouslyspecified.Youcandothisasfollows:

    • ClickPaineldeControle>FerramentasAdministrativasorInternetInformationServicestopublishonlyfinalfiles
    • Createapublishingprofile
    • Checkinetmgraspublishmethod
    • InthesettingscheckPropriedades

    Note:SettingsmaynotappearinsomeversionsofVisualStudio

    Connecting Visual Studio to local or remote IIS for debugging

    If you have correctly marked the project with Todos (não atribuídos) and unchecked Build Visual Studio should be debugging correctly, but if this does not happen for some reason, follow these steps:

    • Ensure that Visual Studio is running as Administrator ( Publish , in the right-click options when running it)
    • Ensure that IIS is running through the administrative panel Publish Website
    • Press Ctrl + Alt + P , and then press w
    • Select process File System
    • Ensure Debug is selected in Use Local IIS Server or Use IIS Express in Run as Administrator depending on version of Visual Studio
    • Press the Internet Information Services

        
    23.04.2015 / 13:36