Sync Framwework 3.0 (June 2010)- Security Exception
-
20 sierpnia 2010 20:09
Hello:
I'm trying to run the desktop Silverlight application available in the "Samples overview" section and experiencing the following exception when I run the Silverlight applicaiton from VS.NET 2010.
Synchronization failed: System.Security.SecurityException ---> System.Security.SecurityException: Security error.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)
--- End of inner exception stack trace ---
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at Microsoft.Synchronization.ClientServices.HttpCacheRequestHandler.OnDownloadGetResponseCompleted(IAsyncResult asyncResult)The List Service is deployed in IIS 7 (Windows 7). The required permission has been setup for AUTHORITY\NETWORK SERVICE for the Login name (in IIS and SQL Express Database)
I have the following clientaccesspolicy.xml added in the IIS root (C:\inetpub\wwwroot) and still unable to solve this. Please help!!
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<!--Enables Silverlight 3 all methods functionality-->
<policy>
<allow-from http-methods="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/api" include-subpaths="true"/>
</grant-to>
</policy>
<!--Enables Silverlight 2 clients to continue to work normally -->
<policy>
<allow-from >
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/api" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
Wszystkie odpowiedzi
-
20 sierpnia 2010 20:18Moderator
Did you use fiddler to try to sniff the network traffic between the browser and service? This will tell us which request is failing.
Maheshwar Jayaraman - http://blogs.msdn.com/mahjayar -
21 sierpnia 2010 14:13
Thanks Mahesjwar. I just see one request to http://localhost/clientaccesspolicy.xml which returns status code (304 - not modified). I do not see any calls to http://localhost/ListService/DefaultScopeSyncService.SVC/.
- When I browse the service directly from IIS, it returns a message "Method Not allowed".
- I have even tried hosting the client application (\samples\SLSample\ListsSample\ListsSampleSite) in IIS. Now, it asks me to enter the user name. When I do so (ex: test), it throws an exception stating "System.Net. WebException: The remote server returned an error: Not found".
- When I run the Silverlight client application from VS.NET, it does not promt the login screen. It simply throws the security exception I reported earlier at the bottom of the screen.
- My IIS App pool is configured to use .NET 4.0 (32 compatibility enabled)
- Please note I have already followed the fix per: http://social.microsoft.com/Forums/en-US/synclab/thread/cd366786-5aac-4396-adba-00d6c8af0652
I'm not sure what I'm missing here. Please help!!
-
23 sierpnia 2010 06:45
Your original problem, the security exception, is a result from your clientaccesspolicy.xml - in your version you allow access to /api but the webservice lives at another URI. Here is a more general clientaccesspolicy.xml which is just fine for a developer's workstation:
<?xml version="1.0" encoding="utf-8"?> <access-policy> <cross-domain-access> <policy> <allow-from http-request-headers="*"> <domain uri="*"/> </allow-from> <grant-to> <resource path="/" include-subpaths="true"/> </grant-to> </policy> </cross-domain-access> </access-policy>
- Zaproponowany jako odpowiedź przez M.Bi 23 sierpnia 2010 06:53
-
23 sierpnia 2010 06:53
- When I browse the service directly from IIS, it returns a message "Method Not allowed".
This is normal. Your browser sends a basic unparameterized GET request to the base URI but the webservice expects mostly POST requests. Please refer to the SyncFx 3.0 docs, page "OData Sync: HTTP".- I have even tried hosting the client application (\samples\SLSample\ListsSample\ListsSampleSite) in IIS. Now, it asks me to enter the user name. When I do so (ex: test), it throws an exception stating "System.Net. WebException: The remote server returned an error: Not found".
Unfortunatly this error doesn't tell anything about the underlying reason. If the problem remains after fixing your clientaccesspolicy.xml (see above post) you will have to debug it by evaulating the HTTP traffic. Also make sure to set ISyncServiceConfiguration.UseVerboseErrors = true in your SyncService.
- Oznaczony jako odpowiedź przez arasheed 24 sierpnia 2010 16:00
-
23 sierpnia 2010 17:11
Thanks Bi. This fixed my security exception but the other issue is still open. The configuration is already ISyncServiceConfiguration.UseVerboseErrors = true
I tried tracing the HTTP traffic using HTTP analyzer and observe the following:
As soon as I enter the user name there is a call to http://localhost/ListService/login.ashx?username=Rasheed . The http traffic at this stage "Request is not completed. Waiting"
At this point, I'm displayed with an error
The Following error occurred when attempting to logon:
"System.Net. WebException: The remote server returned an error: Not found
I don't see anything in the HTTP traffic. Please advice.
Rasheed
-
23 sierpnia 2010 22:28Moderator
You should also change your IIS App Pool to the DefaultAppPool with .NET 2.0 and Pipeline mode: Integrated
Maria del Mar Alvarez Rohena Microsoft Sync Framework- Zaproponowany jako odpowiedź przez María del Mar Alvarez RohenaMicrosoft Employee, Moderator 23 sierpnia 2010 22:37
-
23 sierpnia 2010 23:27
Thanks but the problem still remains the same. I have even repeated these steps in a Windows XP box. It return the same exact error when I attempt to logon.
The Following error occurred when attempting to logon:
"System.Net. WebException: The remote server returned an error: Not found
I have a demo setup tomorrow and I'm exhausted :(
-
23 sierpnia 2010 23:39Moderator
Is Capture Traffic selected on Fiddler? You can check for this under the File menu.
You can also try to Debug the List Service to figure out where the WebException is being thrown. To do this, on Visual Studio go to Debug -> Attach To Process (make sure Show processes in al sessions is checked) and select w3wp.exe, which is the IIS process.
Then on Debug->Exceptions make sure Common Runtime Language Exceptions Thrown is checked.
Then retry the attempt to login. You should be able to see the debug stack trace when the exception is hit.
Maria del Mar Alvarez Rohena Microsoft Sync Framework- Oznaczony jako odpowiedź przez arasheed 24 sierpnia 2010 16:00
-
24 sierpnia 2010 14:41
Thank you very much everyone. I'm able to finally fix this issue with all your feedback. The issue was that Windows XP requires ASP.NET user permission to access the Database, and isolated storage. I'm able to launch the application with one caveat. The "My Tags" tab is always empty. I would expect this to be populated from Database. Please advice.- Oznaczony jako odpowiedź przez arasheed 26 sierpnia 2010 17:13
-
25 sierpnia 2010 06:17
one caveat. The "My Tags" tab is always empty. I would expect this to be populated from Database. Please advice.
Once you add some lists and tag those you will see that "My Tags" becomes to live, too.- Oznaczony jako odpowiedź przez arasheed 25 sierpnia 2010 13:31
-
24 sierpnia 2011 22:43I followed the ListService example which comes with MSF 4.0 and created a simple service and hosted it on my local IIS 7.0. Everything works fine. When I try to deploy the same project on our deployment server (Windows Server 2008 Enterprise Edition) I am getting the following exception: [System.Net.WebException] = {System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound.at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)at Sys...I have added the crossdomain.xml and clientaccesspolicy.xml files to the service. Still I getting the same exception.
-
26 sierpnia 2011 00:52Moderatoruser fiddler to sniff the traffic and see the underlying error.