国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

ASP.NET訪問共享文件夾

2019-11-14 14:31:41
字體:
來源:轉載
供稿:網友

配置代碼:

var dataPRotection = new Microsoft.aspNet.DataProtection.DataProtectionProvider(new DirectoryInfo(@"//10.10.10.10/shared-auth-ticket-keys/"));app.UseCookieAuthentication((cookieOptions) =>{    cookieOptions.AutomaticAuthenticate = true;    cookieOptions.AutomaticChallenge = true;    cookieOptions.CookieHttpOnly = true;    cookieOptions.ExpireTimeSpan = TimeSpan.FromMinutes(43200);    cookieOptions.LoginPath = new PathString("/account/login");    cookieOptions.CookieName = ".CNBlogsAdCookie";    cookieOptions.CookiePath = "/";    cookieOptions.DataProtectionProvider = dataProtection;});

異常信息:

[Error] An unhandled exception was thrown by the application.System.Security.Cryptography.CryptographicException: An error occurred while trying to encrypt the provided data. Refer to the inner exception for more information. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path '//10.10.10.10/shared-auth-ticket-keys'.   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)   at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)   at System.IO.DirectoryInfo.Create()   at Microsoft.AspNet.DataProtection.Repositories.FileSystemxmlRepository.<GetAllElementsCore>d__15.MoveNext()   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)   at Microsoft.AspNet.DataProtection.Repositories.FileSystemXmlRepository.GetAllElements()   at Microsoft.AspNet.DataProtection.KeyManagement.XmlKeyManager.GetAllKeys()   at Microsoft.AspNet.DataProtection.KeyManagement.KeyRingProvider.CreateCacheableKeyRingCore(DateTimeOffset now, IKey keyJustAdded)   at Microsoft.AspNet.DataProtection.KeyManagement.KeyRingProvider.Microsoft.AspNet.DataProtection.KeyManagement.Internal.ICacheableKeyRingProvider.GetCacheableKeyRing(DateTimeOffset now)   at Microsoft.AspNet.DataProtection.KeyManagement.KeyRingProvider.GetCurrentKeyRingCore(DateTime utcNow)   at Microsoft.AspNet.DataProtection.KeyManagement.KeyRingProvider.GetCurrentKeyRing()   at Microsoft.AspNet.DataProtection.KeyManagement.KeyRingBasedDataProtector.Protect(Byte[] plaintext)   --- End of inner exception stack trace ---   at Microsoft.AspNet.DataProtection.KeyManagement.KeyRingBasedDataProtector.Protect(Byte[] plaintext)   at Microsoft.AspNet.Authentication.SecureDataFormat`1.Protect(TData data, String purpose)   at Microsoft.AspNet.Authentication.Cookies.CookieAuthenticationHandler.<HandleSignInAsync>d__13.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at Microsoft.AspNet.Authentication.AuthenticationHandler`1.<SignInAsync>d__61.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at Microsoft.AspNet.Http.Authentication.Internal.DefaultAuthenticationManager.<SignInAsync>d__13.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at CNBlogs.Ad.Web.Controllers.AccountController.<LoginSubmit>d__3.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at Microsoft.AspNet.Mvc.Controllers.ControllerActionExecutor.<CastToObject>d__8`1.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at Microsoft.AspNet.Mvc.Controllers.ControllerActionInvoker.<InvokeActionAsync>d__6.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)   at Microsoft.AspNet.Mvc.Controllers.FilterActionInvoker.<InvokeActionFilterAsync>d__42.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at Microsoft.AspNet.Mvc.Controllers.FilterActionInvoker.<InvokeAsync>d__33.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at Microsoft.AspNet.Mvc.Infrastructure.MvcRouteHandler.<InvokeActionAsync>d__8.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at Microsoft.AspNet.Builder.RouterMiddleware.<Invoke>d__4.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at Microsoft.AspNet.IISPlatformHandler.IISPlatformHandlerMiddleware.<Invoke>d__4.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at Microsoft.AspNet.Hosting.Internal.RequestServicesContainerMiddleware.<Invoke>d__3.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at Microsoft.AspNet.Hosting.Internal.HostingApplication.<ProcessRequestAsync>d__7.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at Microsoft.AspNet.Server.Kestrel.Http.Frame`1.<RequestProcessingAsync>d__3.MoveNext()

10.10.10.10 是共享文件服務器,但另一臺 Web 服務器訪問的時候,會出現上面的錯誤(文件資源管理可以直接訪問)。

解決方案(參考):

  1. On your IIS machine, create a user called IUSER_SHARE (or whatever). Set a passWord!
  2. On your network share machine, create a user called IUSER_SHARE and set the same password.
  3. In IIS Manager, select the application pool that your web app is using (create a new one if you are using the default ones). Click on Advanced Settings in the right Actions bar. Under Process Model, change the user to IUSER_SHARE.

補充:第一、二步,在共享文件服務和 Web 服務器,分別創建一個 IUSER_SHARE 賬戶(密碼相同),第三部需要更改 asp.net 應用程序池的賬戶(也需要新建相同的賬戶),示意圖:


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 彰武县| 桐庐县| 松原市| 高台县| 海兴县| 孝义市| 柘荣县| 临泉县| 武川县| 察哈| 日喀则市| 梨树县| 河东区| 巴彦县| 三穗县| 习水县| 措勤县| 天等县| 桂平市| 阳西县| 盐津县| 潼南县| 商河县| 鄂伦春自治旗| 云南省| 浦县| 玛纳斯县| 和政县| 芦溪县| 略阳县| 东辽县| 道孚县| 津南区| 鞍山市| 德阳市| 肃南| 乌拉特后旗| 正阳县| 永兴县| 龙南县| 光泽县|