PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → How to tell Windev 23 REST webservice to use a custom web.config instead of the machine.config ?
How to tell Windev 23 REST webservice to use a custom web.config instead of the machine.config ?
Débuté par Peter DEWACHTERE, 10 déc. 2018 16:54 - Aucune réponse
Membre enregistré
1 message
Posté le 10 décembre 2018 - 16:54
I have this REST webservice (wd23) deployed on a IIS7.5 webserver.
I added the System.Web.Security assembly of the .Net framework to be able to call the ChangePassword method on the MembershipUser class.

So I create this object:
user is "System.Web.Security.MembershipUser" dynamic

and I call this method:
bRes is boolean = user.ChangePassword(sOldPassword,sNewPassword)

This works fine in production as long as I define the membership/rolemanager providers and its connectionstring in the machine.config of the server.

This is the part of the machine.config I added:

<connectionStrings>
<add name="MySecurityDB" connectionString="..." providerName="System.Data.SqlClient"
</connectionStrings>
<membership defaultProvider="MyMembershipProvider">
<providers>
<add
name="MyMembershipProvider"
connectionStringName="MySecurityDB"
applicationName="Website"
...
type="System.Web.Security.SqlMembershipProvider" />
<add
name="AspNetSqlMembershipProvider"
connectionStringName="LocalSqlServer"
applicationName="/"
...
type="System.Web.Security.SqlMembershipProvider" />
</providers>
</membership>
<roleManager defaultProvider="MyRoleProvider">
<providers>
<add
name="MyRoleProvider"
connectionStringName="MySecurityDB"
applicationName="Website"
type="System.Web.Security.SqlRoleProvider" />
<add
name="AspNetSqlRoleProvider"
connectionStringName="LocalSqlServer"
applicationName="/"
type="System.Web.Security.SqlRoleProvider" />
</providers>
</roleManager>

The normal way of overriding the machine.config is to put a local web.config in the rootfolder.
So if I don't add it to the machine.config but to a web.config in the root of the webservice, these settings are not picked up by the windev webservice. It seems the webservice can't find the custom web.config. I can view in my log that the webservice uses the 'default membership settings' and default 'LocalSqlServer' connectionstring of the machine.config instead.

Any ideas on how to solve this ?

gr, Peter