Tag: iis 7

FileNotFoundException IIS7

我有一个在VS2010中运行完美的C#Web应用程序,但是当部署到IIS7服务器时,返回“图像未找到图标”。 有问题的代码基本上抓取网络共享位置上的图像缩略图,进行操作,然后推回到网页。 Web服务器与它尝试访问的文件位于同一网络上。 访问此网页的所有用户都在同一本地Intranet上。 该应用程序是存储的网络节省资源列表,这些资源以这种或那种方式分类。 部署应用程序时,它会在我的应用程序日志中找到上述两个错误。 我觉得这是一个文件权限错误,并且两个错误是链接的,但我不知道在哪里更改权限以使应用程序正常工作。 Exception information: Exception type: FileNotFoundException Exception message: T:\Published\Generic.jpg 但是,如果我拿“T:\ Published \ Generic.jpg”并将其插入我的IE地址栏。 它加载图像。 处理图像的代码部分是这样的: System.Drawing.Image img; img = System.Drawing.Image.FromFile(MapPath(Request.QueryString[“File”].ToString())); 我已经尝试过使用和不使用MapPath方法。 我尝试调试应用程序,但因为它在VS2010中工作,它不会抛出exception所以我不知道为什么它被扔在IIS服务器上。 整个堆栈跟踪请求: Event code: 3005 Event message: An unhandled exception has occurred. Event time: 13/02/2012 4:16:26 PM Event time (UTC): 13/02/2012 11:16:26 PM Event ID: 1f01693f71a2443790a8d83ba06a88a4 Event sequence: […]

添加自定义请求标头适用于IIS 7.0但不适用于Asp.net开发服务器

我们正在跟踪请求响应所需的总时间。 我们使用global.asax.cs的Application_AcquireRequestState中的请求的唯一键实现了添加的自定义头: request.headers.add(“reqKey”,key) 。 当针对该请求命中Application_PostRequestHandlerExecute时,它会将带有唯一键的自定义标头拉回,并使用该记录记录总响应时间。 还记录了许多其他内容,例如用户名,表单数据等,而不仅仅是简单的计时。 当代码在IIS 7.5上运行时,这当前工作正常。 但是,当它在ASP.Net开发服务器上运行时,它会抛出Operation is not supported on this platformexceptionOperation is not supported on this platform的Operation is not supported on this platform 。 我们的产品是IIS 7,那么我该如何解决这个错误呢?

添加https绑定时,Microsoft.Web.Administration中的NullReferenceException

我正在尝试以编程方式将绑定添加到我的默认网站,但我一直在Microsoft.Web.Administration dll中获得空引用exception。 最初我想分配证书和绑定。 我能够用这个查询我想要的证书: var store = new X509Store(StoreName.Root, StoreLocation.LocalMachine); store.Open(OpenFlags.OpenExistingOnly | OpenFlags.ReadWrite); var certificate = store.Certificates.Find(X509FindType.FindByIssuerName, “TEST_SELF_SIGNED”, true) .OfType().FirstOrDefault(); 这恰当地给了我我想要的证书,它是非空的并且有我期望的信息。 Site site = GetSite(“Default Web Site”); var binding = site.Bindings.Add(“*:443”, certificate.GetCertHash(), “https”); 鉴于我的变量或示例代码中的任何其他项都不为null(包括返回20字节数组的GetCertHash),我很困惑为什么我在这里得到一个null。 我甚至试过以下重载: site.Bindings.Add(“*:443”, “https”); 我仍然得到相同的空ref堆栈: System.NullReferenceException未处理 Message =对象引用未设置为对象的实例。 来源= Microsoft.Web.Administration 堆栈跟踪: 在Microsoft.Web.Administration.Configuration.SetDirty() 在Microsoft.Web.Administration.ConfigurationElement.SetDirty() 在Microsoft.Web.Administration.ConfigurationElement.SetAttributeValue(String attributeName,Object value) 在Microsoft.Web.Administration.Binding.SetBindingProperty(String attributeName,String value) 在Microsoft.Web.Administration.BindingCollection.Add(String bindingInformation,Byte [] […]

有没有办法忽略2GB文件上传的maxRequestLength限制?

这里我将maxRequestLength设置为2GB(最大值),这表示ASP.NET支持的最大请求大小: … 在这里我将maxAllowedContentLength设置为4GB(最大值),它指定IIS支持的请求中的最大内容长度 … 我希望能够上传最大4GB的文件,但我受到maxRequestLength字段的限制。 我注意到这个第三方上传工具(http://www.element-it.com/onlinehelp/webconfig.html)有一个ignoreHttpRuntimeMaxRequestLength属性,允许它上传最大4GB的文件。 有谁知道我是否可以像其他上传工具一样忽略maxRequestLength值?

获取IIS-7及更高版本的网站ID

通过将ID作为参数传递,我能够以编程方式(C#)获取IIS-7(C:\ Windows \ System32 \ inetsrv \ config \ applicationHost.config)中托管的任何网站的物理路径。 但是通过代码找到Id失败的iis7。 错误消息是 COMException(0x80005000):未知错误(0x80005000) 即使在添加Microsoft.Web.Administration程序集( http://cstruter.com/blog/306 )后仍无法解决。 作为参考,这是我用来获取ID的代码: public static int GetWebSiteId(string serverName, string websiteName) { int result = 2; DirectoryEntry w3svc = new DirectoryEntry( string.Format(“IIS://{0}/w3svc”, serverName)); foreach (DirectoryEntry site in w3svc.Children) { if (site.Properties[“ServerComment”] != null) { if (site.Properties[“ServerComment”].Value != null) { if (string.Compare(site.Properties[“ServerComment”].Value.ToString(), websiteName, […]

System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)拒绝访问

我试图上传文件并将其转换为另一种格式,然后将其保存在我的Web服务器上,但是我收到以下错误:System.ComponentModel.Win32Exception(0x80004005):在System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)中拒绝访问)在System.Diagnostics.Process.Start() 当我尝试在本地计算机的Web服务器(Windows 7)上执行此操作时没有问题,但是在将我的网站部署到具有Windows Server 2008 R2的Web托管提供商后,我收到此错误。 我正在使用ASP.NET c#。 我猜这是一个权限问题,但我不知道如何提升任何权限。 请帮忙!

错误:System.DirectoryServices.AccountManagement.UserPrincipal.FindByIdentity中出现“操作错误”

我有以下代码来检索我的MVC3 Web应用程序中给定用户名的AD组: PrincipalContext userDomain = new PrincipalContext(ContextType.Domain, username.Split(‘\\’)[0]); UserPrincipal user = UserPrincipal.FindByIdentity(userDomain, username); PrincipalSearchResult memberOfGroups = user.GetGroups(); IEnumerator memberOfGroupsEnumerator = memberOfGroups.GetEnumerator(); List userADGroups = new List(); try { while (memberOfGroupsEnumerator.MoveNext()) { userADGroups.Add(memberOfGroupsEnumerator.Current.ToString()); } } catch { // When trying to access AD groups of a different domain, issues can arise at the end of the […]

回收调用Application_Start吗?

Application_Start是否在IIS 7中被回收调用? 谢谢

HttpWebRequest中的“无法连接到远程服务器失败”

我正在使用VSTS 2008 + C#+ .Net 3.5来开发控制台应用程序,并将请求发送到另一台服务器(Windows Server 2008上的IIS 7.0)。 我发现当请求线程数很大(例如2000个线程)时,客户端在调用response =(HttpWebResponse)request.GetResponse()时会收到错误“无法连接到远程服务器失败”。我的困惑是 – 我有将超时设置为一个较大的值,但我在一分钟内得到了这样的失败消息。 我认为即使连接确实比IIS可以服务的更大,客户端也不应该这么快就得到这样的失败消息,它应该在超时期后得到这样的消息。 任何意见? 有什么想法有什么不对? 是否有任何想法可以使IIS 7.0提供更多并发连接? 这是我的代码, class Program { private static int ClientCount = 2000; private static string TargetURL = “http://labtest/abc.wmv”; private static int Timeout = 3600; static void PerformanceWorker() { Stream dataStream = null; HttpWebRequest request = null; HttpWebResponse response = […]

如何在IIS7中获取与应用程序池关联的应用程序

我有一个虚拟目录名称。 对于这个虚拟目录,我必须找出相关的应用程序池。 一旦我得到应用程序池,我必须找出这个应用程序池中的所有虚拟目录..我正在使用此代码找出与虚拟目录关联的应用程序池 string AppPoolName = string.Empty; ServerManager manager = new ServerManager(); foreach (Site site in manager.Sites) { foreach (Application app in site.Applications) { string path = app.Path; path = path.Replace(“/”, ” “); path = path.Trim(); if (path.ToLower() == VDName.ToLower()) { AppPoolName = app.ApplicationPoolName; break; } } }