Web Connection
Error after adding a process class
Gravatar is a globally recognized avatar based on your email address. Error after adding a process class
  Paulo Martins
  All
  Jan 3, 2022 @ 09:47am

Hi Whenever I add a new ProcessClass object, when navigating to this resource, the error in the image below occurs, which resolves itself by deleting the following lines in web.config file of the new process:

			<add name=".wc_wconnect-module" path="*.wc" verb="*" type="Westwind.WebConnection.WebConnectionHandler,WebConnectionModule" preCondition="integratedMode"/>
			<add name=".wcs_wconnect-module" path="*.wcs" verb="*" type="Westwind.WebConnection.WebConnectionHandler,WebConnectionModule" preCondition="integratedMode"/>
			<add name=".md_wconnect-module" path="*.md" verb="*" type="Westwind.WebConnection.WebConnectionHandler,WebConnectionModule" preCondition="integratedMode"/>

and 
		<modules>
			<add name="WebConnectionModule" type="Westwind.WebConnection.WebConnectionModule,WebConnectionModule"/>
		</modules>

I followed the steps indicated in the tutorial. What am I doing wrong, or must this be the behavior?

Gravatar is a globally recognized avatar based on your email address. re: Error after adding a process class
  Paulo Martins
  Tore Bleken
  Jan 3, 2022 @ 01:04pm

Thanks!

I made the suggested change, but the error remains.

I suppose that, as the main process of the site already contains the entries in the respective web.config file, when they are **added again **in the web.config file of the new process, it is considered as a duplicate key, which causes the error.

Gravatar is a globally recognized avatar based on your email address. re: Error after adding a process class
  Rick Strahl
  Paulo Martins
  Jan 3, 2022 @ 01:22pm

Not sure what the error message says - can you translate please since you didn't post the text?

Guessing - you have a another application at a higher level in the IIS Application hierarchy. Any child site inherits the parent's web.config settings, and many settings like module names can't be added again. You can use <remove name=".wc_wconnect-module" /> before the handler gets added.

But maybe more generically - don't add child applications below a parent application - always put them into different folder hierarchies (siblings is OK, children is not) or better yet create top level sites in completely different folders. If you do nest be prepared to troubleshoot issues with configuration settings not being easy to determine where they are defined (at the parent or the current app).

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Error after adding a process class
  Paulo Martins
  Rick Strahl
  Jan 3, 2022 @ 02:07pm

The error is shown in the image above.

It's not several applications, it's an application (main process) with several modules each with its own process class, as exemplified in the tutorial in the documentation, and using the console, to generate the new process. The wizzard creates a new folder, "processNameWeb" in the main process folder, with its own web.config file.

Is this not the expected or desired behavior?

What I wanted was an application (website) with the following structure: main, main/module1, main/module2, ... main/moduleN

Thank's for your time

Gravatar is a globally recognized avatar based on your email address. re: Error after adding a process class
  Rick Strahl
  Paulo Martins
  Jan 3, 2022 @ 02:28pm

What does the error message say - in English?

If this is a virtual directory in IIS and you have the same .wc scriptmap at the root Web site you are likely to get an error - if this error is what I think it is.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Error after adding a process class
  Bob Roenigk
  Paulo Martins
  Jan 3, 2022 @ 02:28pm

Paulo,

My limited stay in the Azores didn't help very much with my Portuguese. Is the error message saying you cannot add a duplicate collection entry of type 'add' with the unique key attribute name set to 'wc_wconnect-module'?

Gravatar is a globally recognized avatar based on your email address. re: Error after adding a process class
  Rick Strahl
  Bob Roenigk
  Jan 3, 2022 @ 03:11pm

Bob, yeah that's the error message I'm expecting.

It's a duplicate value that comes from higher up in the IIS Site hierarchy - most likely the root Web site that has Web Connection handlers (and other settings perhaps) mapped to it).

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Error after adding a process class
  Paulo Martins
  Rick Strahl
  Jan 4, 2022 @ 06:02am

Sorry, I didn't even remember that the error message was in Portuguese.

Exactly, this is the error. it seems to me the wizard adds these extensions by default to all created processes, and therefore as they were already added to the main process, when adding a new process, with virtual directory, they are added again, which will cause the error.

For me, I solve by eliminating duplicate lines in all processes other than the main one.

Thanks, Paulo

Gravatar is a globally recognized avatar based on your email address. re: Error after adding a process class
  Rick Strahl
  Paulo Martins
  Jan 4, 2022 @ 06:07pm

No that's not the problem. Unless I'm seeing this wrong the handlers are not duplicated in the current application (according to your previous messages). WWWC only adds the new script map via the Add Process Wizard operation, not all the other default ones. The script map creation code checks for existing handlers in the web.config file by reading the file and looking at the XML. It's not reading the hierarchy as it's not actually querying IIS for this.

I'm pretty sure the error comes from the parent Web site - that's the only way you can end up with 'duplicate' keys in the IIS configuration.

You can test this easily and quickly by running the site in IIS Express (if you're running local). Almost certainly it will run there, because it won't have the parent site issue as you effectively run the site as a top level site.

On the live site you'll have to fix the web.config manually if the root runs Web Connection and you also have a virtual - by using <remove name="<handler_name>" />. But as I said I'd be really weary of doing this for a live site as settings from the parent will bleed into the child virtual. Virtuals work well if they are siblings, but they are not a good choice if you have a root site and then virtuals below both running Web Connection.

Even if you're not using Web Connection at root you should check if there are Web Connection specific keys in the web.config of the root site (by accident or a test that wasn't removed) and if so remove them.

+++ Rick ---

© 1996-2022