I have a usernameToken in a VB .Net 2005 Class configured for COM interface
for a VB6 EXE. The VB6 to COM works fine, but the addition of a Proxy is not
found.
The error I keep getting is:
Specified argument was out of the range of valid values.
Parameter name: Policy 'REVSCOMPolicy' is not configured in the system
The other entries I have read reference the Policy names not matching in the
Config files but are specific to ASP.Net and Forms applications but do not
address COM.
Suggestions?
COM Code:
Dim wsREVS As New REVS_WS.ServiceWse
Dim wsToken As New Tokens.UsernameToken(strID, strPSW,
PasswordOption.SendPlainText)
Try
wsREVS.SetClientCredential(wsToken)
wsREVS.SetPolicy("REVSCOMPolicy")
app.Config File
<microsoft.web.services3>
<policy fileName="wse3policyCache.config" />
</microsoft.web.services3>
WSE3Policy.config File
<policies xmlns="http://schemas.microsoft.com/wse/2005/06/policy">
<extensions>
<extension name="usernameOverTransportSecurity"
type="Microsoft.Web.Services3.Design.UsernameOverTransportAssertion,
Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" />
<extension name="requireActionHeader"
type="Microsoft.Web.Services3.Design.RequireActionHeaderAssertion,
Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" />
</extensions>
<policy name="REVSCOMPolicy">
<usernameOverTransportSecurity />
<requireActionHeader />
</policy>
</policies>
Walter Wang [MSFT] - 26 Sep 2007 08:54 GMT
Hi BigJohn,
Based on my understanding, you've created a class library in VB.NET 2005
and registered for com interop and it will be used by your VB6 code. You
created app.config for the VB.NET 2005 class library project to configure
the WSE 3 related settings. You found the added policy name is not found
when VB6 code called the VB.NET 2005 component. Please feel free to correct
me if I've misunderstood anything.
First, the app.config is not used by the compiled class library (.dll). In
other words, although the app.config is copied to the output directory and
named as the .dll but with .dll.config extension, it's not used by .NET at
run-time. This is because .NET configuration file is used per AppDomain and
by default it will only use the .exe.config with the main application.
You can verify this by creating a simple Console project in .NET and add
reference to your class library, then copy the app.config into the Console
project and see if it works.
On the other hand, I understand that you need to make the config file work
with your class library project when called by VB6 code. I will do some
further research to see how to make this work. I'll keep you posted. Please
feel free to let me know if you have any questions or concerns. Thanks.
Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
BigJohn - 27 Sep 2007 13:21 GMT
Due to the urgency of this problem, I opened a Severity 1 ticket and received
the following resolution:
Problem Description:
Implementing a .NET DLL consumed by a VB6 application where the .NET DLL
calls a web service. The web service call uses WSE 3.0 to provide a username
token for security. The web service call fails with the error:
"Run-time error '-2146233086 (80131502)':
Specified argument was out of range of valid values.
Parameter name: Policy 'ClientPolicy' is not configured in the system
Root Cause (if known):
This error is caused by the .NET dll not having access to its app.config and
wse3policycache.config files.
Resolution:
To resolve the problem copy the .NET dll’s app.config and
wse3policycache.config files to the working folder of the hosting VB6
application. Then rename the app.config to match the VB6 exe. The format is
“VB6exename”.exe.config. The name of this file is critical. It must match the
VB6 executable because when the .NET DLL looks for the file it looks for it
under its parent process.
Common Language Resolution:
Given the VB6 desktop distributed name is VB6Desktop.exe, and the COM
component distributed name is MyCOM.dll, copy the MyCOM.dll.config file from
the release directory to the VBDesktop.exe directory and rename it to
VBDesktop.exe.config. Since I was not registering the dll through Component
Services, .Net was running it under the EXE application space which, by
default, the config file is expected there. This works nicely since my dll
is associated with the exe and are always distributed together to be used
only by the one application.
Walter Wang [MSFT] - 28 Sep 2007 03:02 GMT
Hi John,
Thanks very much for sharing the cause and solution here.
Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Durga - VB6 code to call WSE webservice - 30 Nov 2007 19:49 GMT
Hi John,
I have a similar requirement in my project to call a wse webservice from VB
6 code. It would be more helpful if you can share the code for .NET wrapper
and VB6 code to call the webservice. Any pointers would also help.
Thanks
Durga
> Due to the urgency of this problem, I opened a Severity 1 ticket and received
> the following resolution:
[quoted text clipped - 29 lines]
> is associated with the exe and are always distributed together to be used
> only by the one application.
Kan - 06 Feb 2008 15:40 GMT
> I have a usernameToken in a VB .Net 2005 Class configured for COM interface
> for a VB6 EXE. The VB6 to COM works fine, but the addition of a Proxy is not
[quoted text clipped - 41 lines]
> </policy>
> </policies>
hi,
I would like to use a sample application with Vb.Net using the UserToken. i tried to download the example from internet but it alwys fails at X.05 certificate not avialable. Can any one please help in with a sample project using UserToken.
My client application is Vb.Net desktop application.
Thanks in advance.
Hope some one will respond to this post.
Please help.
Kancharla
BizTalk Utilities - Frustration free BizTalk Adapters
http://www.topxml.com/biztalkutilities
Kan - 06 Feb 2008 15:49 GMT
> I have a usernameToken in a VB .Net 2005 Class configured for COM interface
> for a VB6 EXE. The VB6 to COM works fine, but the addition of a Proxy is not
[quoted text clipped - 41 lines]
> </policy>
> </policies>
hi,
I would like to use a sample application with Vb.Net using the UserToken. i tried to download the example from internet but it alwys fails at X.05 certificate not avialable. Can any one please help in with a sample project using UserToken.
My client application is Vb.Net desktop application.
Thanks in advance.
Hope some one will respond to this post.
Please help.
Kancharla
BizTalk Utilities - Frustration free BizTalk Adapters
http://www.topxml.com/biztalkutilities