Exception in deploy

Jan 22, 2009 at 7:29 AM
Edited Feb 10, 2009 at 8:19 AM
Hi,

When I deploy the prototype, I met exception when silverlight requested VE token service hosted by web server.
<s:Envelope xmlns:s="<faultcode">http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="a:InternalServiceFault</faultcode><faultstring">http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</faultcode><faultstring xml:lang="en-US">Unable to cast object of type 'System.Web.Services.Protocols.WebClientAsyncResult' to type 'CompletedAsyncResult'.</faultstring><detail><ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="<HelpLink">http://www.w3.org/2001/XMLSchema-instance"><HelpLink i:nil="true"/><InnerException i:nil="true"/><Message>Unable to cast object of type 'System.Web.Services.Protocols.WebClientAsyncResult' to type 'CompletedAsyncResult'.</Message><StackTrace>   at DeepEarth.VirtualEarth.Services.TokenService.EndGetToken(IAsyncResult asyncResult) in D:\...\DeepEarth\DeepEarth.VirtualEarth.Services\TokenService.cs:line 81&#xD;
   at AsyncInvokeEndEndGetToken(Object , Object[] , IAsyncResult )&#xD;
   at System.ServiceModel.Dispatcher.AsyncMethodInvoker.InvokeEnd(Object instance, Object[]&amp; outputs, IAsyncResult result)&#xD;
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeEnd(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage7(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage6(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace><Type>System.InvalidCastException</Type></ExceptionDetail></detail></s:Fault></s:Body></s:Envelope>

It was thrown by:

public string EndGetToken(IAsyncResult asyncResult) {
   string result;
   if (asyncResult.CompletedSynchronously) {
    result = ((CompletedAsyncResult)asyncResult).Result;   <-----------------------------this line
   } else {
    try {
     result = commonservice.EndGetClientToken(asyncResult);
     HttpContext.Current.Session[cacheKey] = result;
    } catch (Exception e) {
     //You need to get a Virtual Earth Web Service (VEWS) ID and password
     //by setting up a developer account at https://mappoint-css.live.com/mwssignup
     //in order to use VE tiles and services. A free 90 day account takes about 2 hours
     //to be provisioned.
     throw new Exception("Error Getting Token for Virtual Earth Service, have you set your ID and Password in the web.config file?", e);
    }
   }
   // Return the asynchronous result from the other Web service.
   return result;
  }

But when I run the prototype in IDE, everything works well.
Any idea for this?
=====================================================================================================================
resovle this by:
http://forums.asp.net/t/992641.aspx

Thanks!
Coordinator
Jan 22, 2009 at 8:40 AM
What trust level is your web application running under? I recall someone had an error with the token service previously running under medium trust.
Jan 22, 2009 at 9:01 AM
Edited Jan 22, 2009 at 9:02 AM
I checked my web config, and I didn't config the trust level. So I think the trust level will be default one: Full trust
Jan 22, 2009 at 10:33 AM
Edited Jan 22, 2009 at 10:38 AM
im also getting same exception in 

public

string EndGetToken(IAsyncResult asyncResult) {

 

 

 

string result;

 

 

 

if (asyncResult.CompletedSynchronously) {

 

result = ((

 

CompletedAsyncResult)asyncResult).Result;

 

}

 

else {

 

 

 

try {

 

result = commonservice.EndGetClientToken(asyncResult);

 

 

HttpContext.Current.Session[cacheKey] = result;

 

}

 

catch (Exception ex) {

 

 

 

throw ex;  <-- 401, unauthorized exception

 

 

 

//You need to get a Virtual Earth Web Service (VEWS) ID and password

 

 

 

//by setting up a developer account at https://mappoint-css.live.com/mwssignup

 

 

 

//in order to use VE tiles and services. A free 90 day account takes about 2 hours

 

 

 

//to be provisioned.

 

 

 

//throw new Exception("Error Getting Token for Virtual Earth Service, have you set your ID and Password in the web.config file?");

 

 

}

}

exception is --> The request failed with HTTP status 401: Unauthorized.

any solution for this?


Thanks in advance
Ree

Coordinator
Jan 22, 2009 at 11:05 PM
sorry didn't read your error message correctly is it?
"Unable to cast object of type 'System.Web.Services.Protocols.WebClientAsyncResult' to type 'CompletedAsyncResult'"

Wierd, have you modified anything? This async model was taken from the MSDN documentation about Async WCF calls.

What is your system configuration? You are running .net3.5sp1 on the server? Win2003 or 2008?
Jan 23, 2009 at 11:39 PM
Yes, it's .net 3.5 and win2003..
Coordinator
Jan 27, 2009 at 1:29 AM
We found a bug today where we only ever called the staging server for tokens. In the latest changeset we now have a third setting in the web.config to set either the staging or production path, default is now production. I don't think this is the issue here but it maybe worth testing.
If you're interested I could also send you a really simple SL app to test the token and 1 service is working outside of DeepEarth. Sorry I don't have a better solution for you.
Jan 28, 2009 at 8:58 AM
Hi, I'm still having trouble getting the prototype project in the latest changeset [18146] to work properly. 

I've made sure that the endpoint addresses in ServiceReferences.ClientConfig in both Silverlight and the service side match and point to the staging addresses:

...
     <client>
            <endpoint address="http://localhost:52638/DeepEarthPrototypeWeb/Services/VETokenService.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITokenService"
                contract="TokenService.ITokenService" name="BasicHttpBinding_ITokenService" />
            <endpoint address="http://staging.dev.virtualearth.net/webservices/v1/geocodeservice/GeocodeService.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IGeocodeService"
                contract="VEGeocodeService.IGeocodeService" name="BasicHttpBinding_IGeocodeService" />
            <endpoint address="http://staging.dev.virtualearth.net/webservices/v1/imageryservice/imageryservice.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IImageryService"
                contract="VEImageryService.IImageryService" name="BasicHttpBinding_IImageryService" />
            <endpoint address="http://staging.dev.virtualearth.net/webservices/v1/routeservice/routeservice.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IRouteService"
                contract="VERouteService.IRouteService" name="BasicHttpBinding_IRouteService" />
      </client>
...


Also, I've set the VETokenUserName,VETokenPassword, and VETokenServiceUrl (which points to http://staging.common.virtualearth.net/find-30/common.asmx) with the appropriate values.   When I run the web prototype project, it throws an error in Reference.cs

System.ServiceModel.CommunicationException was unhandled by user code
  Message="The remote server returned an error: NotFound"
  StackTrace:
       at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
       at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
       at DeepEarth.Provider.VirtualEarth.VEImageryService.ImageryServiceClient.ImageryServiceClientChannel.EndGetImageryMetadata(IAsyncResult result)
       at DeepEarth.Provider.VirtualEarth.VEImageryService.ImageryServiceClient.DeepEarth.Provider.VirtualEarth.VEImageryService.IImageryService.EndGetImageryMetadata(IAsyncResult result)
       at DeepEarth.Provider.VirtualEarth.VEImageryService.ImageryServiceClient.OnEndGetImageryMetadata(IAsyncResult result)
       at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
  InnerException: System.Net.WebException
       Message="The remote server returned an error: NotFound"
       StackTrace:
            at System.Net.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
            at System.Net.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
            at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
       InnerException: System.Net.WebException
            Message="The remote server returned an error: NotFound"
            StackTrace:
                 at System.Net.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
                 at System.Net.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
                 at System.Net.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)
            InnerException:

I've tried using fiddler2 to diagnose issues..couldn't find anything.  I'm frustrated and grasping straws....Can you please help me resolve this issue, and/or better yet, post another change set that will function correctly out of the box after updating only VETokenUserName and VETokenPassword?

Thanks!
Jan 28, 2009 at 9:59 AM
I've downloaded and configured the latest changeset [18172] to see if I'd get lucky.  Unfortunately, no progress.  I've rebuilt the service references in DeepEarth.Provider.VirtualEarth, but that hasn't fixed it. 
Any ideas?
Feb 9, 2009 at 1:58 AM
Thanks!

Please send a copy to liulike.cn@gmail.com
Mar 10, 2009 at 4:01 PM
Any traction on this error? We've been hit with this as well. We're Vista/.NET3.5/VS2008/Blend2.

Here's the error:
{System.ServiceModel.CommunicationException: The remote server returned an error: NotFound ---> System.Net.WebException: The remote server returned an error: NotFound ---> System.Net.WebException: The remote server returned an error: NotFound
   at System.Net.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
   at System.Net.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
   at System.Net.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)
   --- End of inner exception stack trace ---
   at System.Net.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
   at System.Net.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
   --- End of inner exception stack trace ---
   at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
   at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
   at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
   at DeepEarth.Provider.VirtualEarth.TokenService.TokenServiceClient.TokenServiceClientChannel.EndGetToken(IAsyncResult result)
   at DeepEarth.Provider.VirtualEarth.TokenService.TokenServiceClient.DeepEarth.Provider.VirtualEarth.TokenService.ITokenService.EndGetToken(IAsyncResult result)
   at DeepEarth.Provider.VirtualEarth.TokenService.TokenServiceClient.OnEndGetToken(IAsyncResult result)
   at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)}

We have been having problems with TortoiseSVN and it may have introduced some errant text in an unknown file. We just don't know where to look.

Thanks.

J
Mar 10, 2009 at 4:07 PM
The error is solution specific. I get the same error on the prototype sample that is imported into our solution. If open a new prototype project (with fresh code) it works fine. Also used Fiddler2 and found that no internet traffic passes from the current solution. The new prototype project downloads two tokens and a million tiles. I'm searching out how to adjust trust settings.
Mar 10, 2009 at 4:16 PM
Edited Mar 10, 2009 at 4:17 PM
More... The trust policy doesn't seem to be the issue. Added the following to web.config with no result.

<

 

securityPolicy>
<
trustLevel name="Full" policyFile="internal"/>
</
securityPolicy>

Aug 15, 2009 at 12:46 PM

i am also having this issue - anyone have an idea??

Aug 15, 2009 at 1:49 PM
refer http://forums.asp.net/t/992641.aspx

2009/8/15 bxs122 <notifications@codeplex.com>:
> From: bxs122
>
> i am also having this issue - anyone have an idea??
>
> Read the full discussion online.
>
> To add a post to this discussion, reply to this email
> ([email removed])
>
> To start a new discussion for this project, email
> [email removed]
>
> You are receiving this email because you subscribed to this discussion on
> CodePlex. You can unsubscribe on codePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any posts
> to this discussion will also be available online at codeplex.com



--
Best,

Like
Coordinator
Aug 16, 2009 at 1:17 AM

Like, so the problem was you needed to use a proxy to reach external URLs? interesting.

Here is a copy of the answer from that link (in case it dissapears)

Better late than never, I suppose. I had the same problem and I stumbled across this post. This is hoping others find it useful.

Check if you have to use a proxy server to access external URLs. In that case, add the following to web.config

<system.net>

    <defaultProxy>

        <proxy usessystemdefault="False" proxyaddress="http://your-proxy-name.domain.com:port-number-if-any" bypassonlocal="True" autoDetect="False" />


    </defaultProxy> 

</system.net>
 

I had a similar problem and this worked for me. Smile 

Aug 16, 2009 at 2:03 AM
Yes, I agree with you:)

2009/8/16 soulsolutions <notifications@codeplex.com>:
> From: soulsolutions
>
> Like, so the problem was you needed to use a proxy to reach external URLs?
> interesting.
>
> Here is a copy of the answer from that link (in case it dissapears)
>
> Better late than never, I suppose. I had the same problem and I stumbled
> across this post. This is hoping others find it useful.
>
> Check if you have to use a proxy server to access external URLs. In that
> case, add the following to web.config
>
> <system.net>
>
>     <defaultProxy>
>
>         <proxy usessystemdefault="False"
> proxyaddress="http://your-proxy-name.domain.com:port-number-if-any"
> bypassonlocal="True" autoDetect="False" />
>
>     </defaultProxy>
>
> </system.net>
>
>
> I had a similar problem and this worked for me.
>
> Read the full discussion online.
>
> To add a post to this discussion, reply to this email
> ([email removed])
>
> To start a new discussion for this project, email
> [email removed]
>
> You are receiving this email because you subscribed to this discussion on
> CodePlex. You can unsubscribe on codePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any posts
> to this discussion will also be available online at codeplex.com



--
Best,

Like