banner



How To Debug Ocx In Vb6 Project Class Not Registered

Copyright © Lex Li. St Lawrence River in Quebec City.

Debugging is very important a procedure for developers to learn more than near the development environment and the code base. And so frustration can be a lot if of a sudden your development tool fails to debug.

I documented a few typical Visual Studio and IIS Express related bug that can prevent debugging from working. But you already noticed that they were almost ASP.NET 4.x projects, and do not use to ASP.NET Core projects.

I wrote nigh ASP.NET Core and Visual Studio in one case. Withal, I didn't reveal enough on all the issues you might hit. So this post would serve the missing pieces.

Unable to connect to web server IIS Express

OK, let'southward go started from an fault bulletin,

Effigy 1: Unable to connect mistake dialog.

Horrible, isn't it? How should we notice out the cause of such an error when the message provides so limited data?

Await a minute, and it does say 'IIS Express', a very special term that might be useful later. Correct, if we search for the string "IIS Express" (don't forget the space in betwixt) in the whole solution, nosotros can easily locate a few spots,

                          Notice all "IIS Express", Subfolders, Find Results ane, Entire Solution, ""      C:\Users\lextm\source\repos\mvccoretest\mvccoretest\Properties\launchSettings.json(eleven): "IIS Express": {      C:\Users\lextm\source\repos\mvccoretest\.vs\config\applicationhost.config(12): within this file and are understood by the IIS Express.      C:\Users\lextm\source\repos\mvccoretest\.vs\config\applicationhost.config(14): %IIS_USER_HOME% — The IIS Express domicile directory for the user      C:\Users\lextm\source\repos\mvccoretest\.vs\config\applicationhost.config(16): %IIS_BIN% — The location of the IIS Express binaries      Matching lines: 4 Matching files: 2 Full files searched: 54                      

Of grade, applicationHost.config is non yet useful here, as we know the lines come from the comments. launchSettings.json is the just matter we should move on to.

The Magic of launchSettings.json

When I wrote about VSIISExeLauncher.exe, I had no thought how launchSettings.json works. It turns out to exist very important a piece of magic.

So simply speaking, the IIS Express section we institute in this file defines a debugging contour, which allows Visual Studio to debug the project using IIS Limited as the host.

At present back to the error bulletin. When it says information technology was "Unable to connect to web server 'IIS Limited'", we know the IIS Express settings must be broken. So what are the expected settings?

Read launchSettings.json again, and we tin encounter

                          {                                          "iisSettings"              :                                          {                                          "windowsAuthentication"              :                                          false              ,                                          "anonymousAuthentication"              :                                          true              ,                                          "iisExpress"              :                                          {                                          "applicationUrl"              :                                          "http://localhost:49875/"              ,                                          "sslPort"              :                                          0                                          }                                          },                                          "profiles"              :                                          {                                          "IIS Limited"              :                                          {                                          "commandName"              :                                          "IISExpress"              ,                                          "launchBrowser"              :                                          true              ,                                          "environmentVariables"              :                                          {                                          "ASPNETCORE_ENVIRONMENT"              :                                          "Development"                                          }                                          },                                          "mvccoretest"              :                                          {                                          "commandName"              :                                          "Project"              ,                                          "launchBrowser"              :                                          true              ,                                          "environmentVariables"              :                                          {                                          "ASPNETCORE_ENVIRONMENT"              :                                          "Development"                                          },                                          "applicationUrl"              :                                          "http://localhost:49876/"                                          }                                          }                                          }                                                  

Correct. It does have a section called "iisSettings", and that'due south exactly where the desired settings are,

  • applicationUrl: "http://localhost:49875/"
  • sslPort: 0

The nil value of sslPort ways Visual Studio expects to launch an HTTP site, and the URL should be http://localhost:49875.

Time to jump to applicationhost.config and keen, nosotros spot the cause in just a infinitesimal,

                          <site              name=              "mvccoretest"              id=              "2"              >              <awarding              path=              "/"              applicationPool=              "Clr4IntegratedAppPool"              >              <virtualDirectory              path=              "/"              physicalPath=              "C:\Users\lextm\source\repos\mvccoretest\mvccoretest"              />              </application>              <bindings>              <binding              protocol=              "http"              bindingInformation=              "*:4987:localhost"              />              </bindings>              </site>                      

Got information technology? The site mapping to this project in fact has no binding that would accept the URL http://localhost:49875/. By calculation a suitable binding, we can resolve the error bulletin.

Note that Visual Studio 2017 fifteen.7 (Preview 2.0) is smart enough to fix broken applicationhost.config every fourth dimension I alter launchSettings.json. So Microsoft finally decides to take actions on the right track.

HTTPS Scenario

OK. Now let's change launchSettings.json to piece of work on HTTPS,

                          {                                          "iisSettings"              :                                          {                                          "windowsAuthentication"              :                                          fake              ,                                          "anonymousAuthentication"              :                                          true              ,                                          "iisExpress"              :                                          {                                          "applicationUrl"              :                                          "http://localhost:49875/"              ,                                          "sslPort"              :                                          44322                                          }                                          },                                          "profiles"              :                                          {                                          "IIS Limited"              :                                          {                                          "commandName"              :                                          "IISExpress"              ,                                          "launchBrowser"              :                                          true              ,                                          "environmentVariables"              :                                          {                                          "ASPNETCORE_ENVIRONMENT"              :                                          "Development"                                          }                                          },                                          "mvccoretest"              :                                          {                                          "commandName"              :                                          "Projection"              ,                                          "launchBrowser"              :                                          truthful              ,                                          "environmentVariables"              :                                          {                                          "ASPNETCORE_ENVIRONMENT"              :                                          "Development"                                          },                                          "applicationUrl"              :                                          "http://localhost:49876/"                                          }                                          }                                          }                                                  

I change sslPort to 44322, then the site should be accessed via https://localhost:44322/.

And so I intentionally break applicationhost.config by irresolute it to,

                          <site              name=              "mvccoretest"              id=              "two"              >              <application              path=              "/"              applicationPool=              "Clr4IntegratedAppPool"              >              <virtualDirectory              path=              "/"              physicalPath=              "C:\Users\lextm\source\repos\mvccoretest\mvccoretest"              />              </application>              <bindings>              <binding              protocol=              "http"              bindingInformation=              "*:49875:localhost"              />              <bounden              protocol=              "https"              bindingInformation=              "*:44321:localhost"              />              </bindings>              </site>                      

Visual Studio does not even bother to report an error this time. Sigh. And then whatever developer hitting the issue would only run across a browser dependent message (Firefox in my case),

Figure 2: Unable to connect error in Firefox.

It'due south a bad thought and I call up I should now report to Microsoft.

Another interesting fact is that sslPort does have a default value of 0, so it tin be deleted from launchSettings.json if yous like. Notwithstanding, if applicationUrl is deleted, an error message would be showed ("The IIS Express settings are missing the App Url property. This is required to configure IIS limited to run the site."),

Figure iii: App Url fault dialog.

Note that how horrible is the mistake bulletin itself, with typo and non plenty information for readers to know what exactly is missing.

Sidenote

I might add more than contents in the futurity, every bit now I am enhancing Jexus Director Visual Studio Project Diagnostics tool to support ASP.NET Core projects.

Stay tuned.

Source: https://blog.lextudio.com/what-should-you-check-when-visual-studio-cannot-debug-asp-net-core-projects-4b5db8c5e129

Posted by: greeneworsoll.blogspot.com

0 Response to "How To Debug Ocx In Vb6 Project Class Not Registered"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel