Request for the permission of type System.Net.WebPermission failed

Oct 13, 2010 at 5:08 PM

I'm using TFS 2010.  I setup a user with full access to TFS 2010, and placed the users credentials in the Web.config.  However this error is logged, and I'm not sure how to debug or resolve this issue.  Any suggestions? 

Error:

Time     : 10/13/2010 10:51:34 AM
Message  : Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
User     : <user>
Request  : OPTIONS /<TeamProject>/<Folder> HTTP/1.1

Exception:
   System.Security.SecurityException: Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
   at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
   at System.Security.CodeAccessPermission.Demand()
   at System.Net.HttpWebRequest..ctor(Uri uri, ServicePoint servicePoint)
   at System.Net.HttpRequestCreator.Create(Uri Uri)
   at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)
   at System.Web.Services.Protocols.WebClientProtocol.GetWebRequest(Uri uri)
   at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest(Uri uri)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest(Uri uri)
   at CodePlex.TfsLibrary.RegistrationWebSvc.Registration.GetWebRequest(Uri uri)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at CodePlex.TfsLibrary.RegistrationWebSvc.Registration.GetRegistrationEntries(String toolId)
   at CodePlex.TfsLibrary.ObjectModel.RegistrationService.GetServiceInterfaceUrl(String tfsUrl, ICredentials credentials, String serviceType, String interfaceName)
   at CodePlex.TfsLibrary.RepositoryWebSvc.RepositoryWebSvcFactory.Create(String tfsUrl, ICredentials credentials)
   at CodePlex.TfsLibrary.ObjectModel.SourceControlService.<>c__DisplayClassd.<GetLatestChangeset>b__c()
   at CodePlex.TfsLibrary.ObjectModel.SourceControlService.WrapWebException[T](WrapWebExceptionDelegate`1 function)
   at SvnBridge.SourceControl.TFSSourceControlProvider.GetLatestVersion() in <path>\SvnBridgeLibrary\SourceControl\TFSSourceControlProvider.cs:line 218
   at SvnBridge.SourceControl.TFSSourceControlProvider.GetItems(Int32 version, String path, Recursion recursion, Boolean returnPropertyFiles) in <path>\SvnBridgeLibrary\SourceControl\TFSSourceControlProvider.cs:line 744
   at SvnBridge.SourceControl.TFSSourceControlProvider.ItemExists(String path, Int32 version) in <path>\SvnBridgeLibrary\SourceControl\TFSSourceControlProvider.cs:line 472
   at SvnBridge.SourceControl.TFSSourceControlProvider.ItemExists(String path) in <path>\SvnBridgeLibrary\SourceControl\TFSSourceControlProvider.cs:line 467
   at SvnBridge.Proxies.RemotingInvocation.Proceed() in <path>\SvnBridgeLibrary\Proxies\RemotingInvocation.cs:line 75
   at SvnBridge.Proxies.TracingInterceptor.Invoke(IInvocation invocation) in <path>\SvnBridgeLibrary\Proxies\TracingInterceptor.cs:line 28
   at SvnBridge.Proxies.RemotingInvocation.Proceed() in <path>\SvnBridgeLibrary\Proxies\RemotingInvocation.cs:line 59
   at SvnBridge.Proxies.RetryOnExceptionsInterceptor`1.Invoke(IInvocation invocation) in <path>\SvnBridgeLibrary\Proxies\RetryOnExceptionsInterceptor.cs:line 27
   at SvnBridge.Proxies.RemotingInvocation.Proceed() in <path>\SvnBridgeLibrary\Proxies\RemotingInvocation.cs:line 59
   at SvnBridge.Proxies.ProxyFactory.RemotingProxy.Invoke(IMessage msg) in <path>\SvnBridgeLibrary\Proxies\ProxyFactory.cs:line 46
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at SvnBridge.SourceControl.TFSSourceControlProvider.ItemExists(String path)
   at SvnBridge.Handlers.OptionsHandler.Handle(IHttpContext context, TFSSourceControlProvider sourceControlProvider) in <path>\SvnBridgeLibrary\RequestHandlers\OptionsHandler.cs:line 25
   at SvnBridge.Handlers.RequestHandlerBase.Handle(IHttpContext context, IPathParser pathParser, NetworkCredential credentials) in <path>\SvnBridgeLibrary\RequestHandlers\RequestHandlerBase.cs:line 46
   at SvnBridge.Net.HttpContextDispatcher.Dispatch(IHttpContext connection) in <path>\SvnBridgeLibrary\Net\HttpContextDispatcher.cs:line 110
   at SvnBridgeServer.SvnBridgeHttpHandler.ProcessRequest(HttpContext context) in <path>\SvnBridgeServer\SvnBridgeHttpHandler.cs:line 59
The action that failed was:
Demand
The type of the first permission that failed was:
System.Net.WebPermission
The first permission that failed was:
<IPermission class="System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1">
<ConnectAccess>
<URI uri="http://localhost:8080/tfs/DefaultCollection/Services/v1\.0/Registration\.asmx"/>
</ConnectAccess>
</IPermission>

The demand was for:
<IPermission class="System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1">
<ConnectAccess>
<URI uri="http://localhost:8080/tfs/DefaultCollection/Services/v1\.0/Registration\.asmx"/>
</ConnectAccess>
</IPermission>

The granted set of the failing assembly was:
<PermissionSet class="System.Security.PermissionSet"
version="1">
<IPermission class="System.Security.Permissions.FileDialogPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Access="Open"/>
<IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Allowed="ApplicationIsolationByUser"
UserQuota="512000"/>
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="Execution"/>
<IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Window="SafeTopLevelWindows"
Clipboard="OwnClipboard"/>
<IPermission class="System.Security.Permissions.UrlIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Url="file:///D:/inetpub/wwwroot/SvnBridge/bin/CodePlex.TfsLibrary.DLL"/>
<IPermission class="System.Security.Permissions.ZoneIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Zone="Internet"/>
<IPermission class="System.Drawing.Printing.PrintingPermission, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
version="1"
Level="SafePrinting"/>
</PermissionSet>

The assembly or AppDomain that failed was:
CodePlex.TfsLibrary, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
The method that caused the failure was:
System.Net.WebRequest GetWebRequest(System.Uri)
The Zone of the assembly that failed was:
Internet
The Url of the assembly that failed was:
file:///D:/inetpub/wwwroot/SvnBridge/bin/CodePlex.TfsLibrary.DLL

Stack Trace:
   at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
   at System.Security.CodeAccessPermission.Demand()
   at System.Net.HttpWebRequest..ctor(Uri uri, ServicePoint servicePoint)
   at System.Net.HttpRequestCreator.Create(Uri Uri)
   at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)
   at System.Web.Services.Protocols.WebClientProtocol.GetWebRequest(Uri uri)
   at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest(Uri uri)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest(Uri uri)
   at CodePlex.TfsLibrary.RegistrationWebSvc.Registration.GetWebRequest(Uri uri)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at CodePlex.TfsLibrary.RegistrationWebSvc.Registration.GetRegistrationEntries(String toolId)
   at CodePlex.TfsLibrary.ObjectModel.RegistrationService.GetServiceInterfaceUrl(String tfsUrl, ICredentials credentials, String serviceType, String interfaceName)
   at CodePlex.TfsLibrary.RepositoryWebSvc.RepositoryWebSvcFactory.Create(String tfsUrl, ICredentials credentials)
   at CodePlex.TfsLibrary.ObjectModel.SourceControlService.<>c__DisplayClassd.<GetLatestChangeset>b__c()
   at CodePlex.TfsLibrary.ObjectModel.SourceControlService.WrapWebException[T](WrapWebExceptionDelegate`1 function)
   at SvnBridge.SourceControl.TFSSourceControlProvider.GetLatestVersion() in <path>\SvnBridgeLibrary\SourceControl\TFSSourceControlProvider.cs:line 218
   at SvnBridge.SourceControl.TFSSourceControlProvider.GetItems(Int32 version, String path, Recursion recursion, Boolean returnPropertyFiles) in <path>\SvnBridgeLibrary\SourceControl\TFSSourceControlProvider.cs:line 744
   at SvnBridge.SourceControl.TFSSourceControlProvider.ItemExists(String path, Int32 version) in <path>\SvnBridgeLibrary\SourceControl\TFSSourceControlProvider.cs:line 472
   at SvnBridge.SourceControl.TFSSourceControlProvider.ItemExists(String path) in <path>\SvnBridgeLibrary\SourceControl\TFSSourceControlProvider.cs:line 467
   at SvnBridge.Proxies.RemotingInvocation.Proceed() in <path>\SvnBridgeLibrary\Proxies\RemotingInvocation.cs:line 75
   at SvnBridge.Proxies.TracingInterceptor.Invoke(IInvocation invocation) in <path>\SvnBridgeLibrary\Proxies\TracingInterceptor.cs:line 28
   at SvnBridge.Proxies.RemotingInvocation.Proceed() in <path>\SvnBridgeLibrary\Proxies\RemotingInvocation.cs:line 59
   at SvnBridge.Proxies.RetryOnExceptionsInterceptor`1.Invoke(IInvocation invocation) in <path>\SvnBridgeLibrary\Proxies\RetryOnExceptionsInterceptor.cs:line 27
   at SvnBridge.Proxies.RemotingInvocation.Proceed() in <path>\SvnBridgeLibrary\Proxies\RemotingInvocation.cs:line 59
   at SvnBridge.Proxies.ProxyFactory.RemotingProxy.Invoke(IMessage msg) in <path>\SvnBridgeLibrary\Proxies\ProxyFactory.cs:line 46
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at SvnBridge.SourceControl.TFSSourceControlProvider.ItemExists(String path)
   at SvnBridge.Handlers.OptionsHandler.Handle(IHttpContext context, TFSSourceControlProvider sourceControlProvider) in <path>\SvnBridgeLibrary\RequestHandlers\OptionsHandler.cs:line 25
   at SvnBridge.Handlers.RequestHandlerBase.Handle(IHttpContext context, IPathParser pathParser, NetworkCredential credentials) in <path>\SvnBridgeLibrary\RequestHandlers\RequestHandlerBase.cs:line 46
   at SvnBridge.Net.HttpContextDispatcher.Dispatch(IHttpContext connection) in <path>\SvnBridgeLibrary\Net\HttpContextDispatcher.cs:line 110
   at SvnBridgeServer.SvnBridgeHttpHandler.ProcessRequest(HttpContext context) in <path>\SvnBridgeServer\SvnBridgeHttpHandler.cs:line 59

Headers:

Connection: TE
Connection: Keep-Alive
Content-Length: 104
Content-Type: text/xml
Accept-Encoding: gzip
Accept-Encoding: gzip
Authorization: Basic <base64>
Host: svnbridge.<domain>.com
TE: trailers
User-Agent: SVN/1.6.13 (r1002816)/TortoiseSVN-1.6.11.20210 neon/0.29.4
DAV: http://subversion.tigris.org/xmlns/dav/svn/depth
DAV: http://subversion.tigris.org/xmlns/dav/svn/mergeinfo
DAV: http://subversion.tigris.org/xmlns/dav/svn/log-revprops

 

Oct 19, 2010 at 4:40 PM

I was able to resolve this issue.

In IIS only enable Basic Authentication.  (You should probably use SSL.)

Downloaded the latest version of "CodePlex Client"
http://codeplexclient.codeplex.com/
I built a release version of this and copied the TfsLibrary.dll

I then grabbed the latest version of SvnBridge, and changed out the reference to the newly compiled TfsLibrary.
I build a release version and coped the bin directory and web.config from SvnBridgeViaIis into my directory setup in IIS.

It worked!  Inspect the web.config and make sure the right attributes are set.  Reference this post for more information.
http://svnbridge.codeplex.com/Thread/View.aspx?ThreadId=77164