Specified argument was out of the range of valid values. Parameter name : Policy is not configured in the system


hi, friends.

i have problem now, , list details following.

 

i testing web service. on client side, add web reference in dll, after compiled, generates dll, example, name serviceagent.dll, , add reference to this dll, run program throw out error:

 

exception in wse - "specified argument out of range of valid values.parameter name: policy

(line:19)

 

but if remove mid-layer serviceagent library project, use external web service directly in client project, works fine. , not know why!  after searched on internet, friends have same problem, think, .net dll can't read configuration file.

 

my client side code listed below:

1.  public quote requestquote(string symbol)  2.  {  3.   quote q = null;  4.  5.   // request quote external service  6.   quoteext qe;  7.   stocktradersecureservicewse serviceproxy = new stocktradersecureservicewse();  8.  9.   // permission external web service  10.   serviceproxy.credentials = system.net.credentialcache.defaultnetworkcredentials;  11.  12.   // create user name token  13.   usernametoken token = new usernametoken("admin", "admin", passwordoption.sendplaintext);  14.  15.   // append token proxy  16.   serviceproxy.setclientcredential<usernametoken>(token);  17.  18.   // set client side policy;  19.   serviceproxy.setpolicy("usernamepolicy");    // ******** @ place error happens.  20.  21.   qe = serviceproxy.requestquoteext("msft");  22.  23.   // create local quote object (from stocktradertypes namespace)  24.   q = new quote();  25.  26.   // map external quoteext object local quote object  27.   // requires manual work because types not map eachother  28.   q.symbol = symbol;  29.   q.company = qe.company_ext;  30.   q.datetime = qe.datetime_ext.tostring();  31.   q.high = qe.high_ext;  32.   q.low = qe.low_ext;  33.   q.open = qe.open_ext;  34.   q.last = qe.last_ext;  35.   q.previous_close = qe.previous_close_ext;  36.   q.change = (qe.last_ext - qe.open_ext);  37.   q.percentchange = q.change / q.last;  38.   q.high_52_week = qe.high_52_week_ext;  39   q.low_52_week = qe.low_52_week_ext;  40.  41.   return q;  42.  }      

 

 

my solution architecture bound server----serviceagent(dll)------client. above error happens when use wse protect the serviceagent. any gratefully appreciated.  

 

 


lincoln fuji xerox solution developing centre, yokohama, kanagawa, japan

moved asmx/wse forum
richard blewett, thinktecture - http://www.dotnetconsult.co.uk/weblog2
twitter: richardblewett


Archived Forums A-B  >  ASMX Web Services and XML Serialization



Comments

Popular posts from this blog

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

Azure DocumentDB Owner resource does not exist

SQL Server 2008 - High Memory Usage