Tag: iis 7

如何将ASP.NET MVC应用程序读取权限授予注册表项?

我已经阅读了有关如何实现这一目标的其他post,但无济于事。 当我将我的应用程序部署到服务器(2008)时,我在运行时收到以下exception: Access to the registry key ‘HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\TeamFoundation\Servers’ is denied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.UnauthorizedAccessException: Access to the registry key ‘HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\TeamFoundation\Servers’ is denied. ASP.NET is not […]

如何使用Microsoft.Web.Administration.dll获取该页面正在运行的站点信息?

我的服务器上有六个站点,我想从IIS7获取一些信息显示在每个页面的页脚中(只要你当然是管理员)。 我正在浏览ServerObject并找到了Sites,但我找不到任何明显的“this site”。 我该怎么做才能获得IIS7中运行该页面的确切站点的信息? 对于快速“黑客”风格的方法,我在default.aspx页面代码后面写了这个: ServerManager serverMgr = new ServerManager(); foreach (Site site in serverMgr.Sites) { string s = info.Text + site.Name + @””; info.Text = s; foreach (Binding binding in site.Bindings) { string t = info.Text + binding.BindingInformation + ” | “; string p = t + binding.Protocol + @””; info.Text = p; } […]

以编程方式更改应用程序的AppPool

我需要更改某个网站下所有/所选应用程序的应用程序池。 我在我的IIS上获得了所有网站和应用程序池,但我无法更改它们。 有任何想法吗? 这就是我到目前为止所做的…它对我来说很奇怪,因为只有字符串改变,而不是对象。 private void ChangeAppPool() { Microsoft.Web.Administration.Site site = (Microsoft.Web.Administration.Site)this.websiteList.SelectedItem; Microsoft.Web.Administration.ApplicationPool appPool = (Microsoft.Web.Administration.ApplicationPool)this.appPoolCombo.SelectedItem; site.Stop(); site.ApplicationDefaults.ApplicationPoolName = appPool.Name; foreach (var item in site.Applications) { item.ApplicationPoolName = appPool.Name; } site.Start(); appPool.Recycle(); } 谢谢

分析器错误消息:文件’/Site.master’不存在

晚上的人!! 坚持这个相当沉闷的问题。 我已经在我的localhost上部署了我的网站(即C:\ inetpub \ wwwroot \ MyWebSite)但是当我在浏览器中访问它时,我收到以下错误消息: Parser Error Message: The file ‘/Site.master’ does not exist. 这很奇怪,因为Site.Master就在根文件夹中。 我的网站上还有2个文件夹,每个文件夹都有一个web.config,我已经将这些文件夹转换为IIS中的应用程序。 当我从这些文件夹访问页面时,会发生此错误。 所以urls: http:// localhost / mywebsite和http:// localhost / mywebsite / mysubfolder都有上述问题。 在这两种情况下,母版页文件都存在于相应的文件夹中。 我在Default.aspx页面中检查了MasterPageFile的路径及其“〜/ Site.Master”,我可以从Visual Studio(即Cassini)中成功运行Web应用程序。 如果有人能帮我解开这个谜团真的很棒。 如果您需要更多信息,请告诉我。 非常感激。

将状态码500发送到客户端时不会呈现页面

我有一个页面(通用处理程序),我想在其上返回状态代码500到客户端,以指示出现问题。 我是这样做的: Response.StatusCode = 500; Response.StatusDescription = “Internal Server Error”; 同时我渲染一条友好的消息,告诉用户出现了问题。 但是,我没有看到我的消息,而是获得了这样的默认IIS消息: 服务器错误500 – 内部服务器错误。 您正在查找的资源存在问题,无法显示。 如果我进入IIS并删除500的错误页面,我收到此消息: 由于发生内部服务器错误,无法显示页面。 它在IIS6中按预期工作,但在IIS7中没有。 我该怎么做才能让它在IIS7中运行?

如何在runAllManagedModulesForAllRequests设置为true的情况下为IIS 7中的flv文件禁用gzip压缩?

我有一个在IIS 7上运行的ASP.NET 3.5网站,我希望我的静态内容(如css文件,javascript文件等)压缩gzip以及我的动态内容(.net页面)。 问题是我需要确保flv文件(flashvideo文件)不是gzip压缩的,因为这会导致我正在使用的Flashvideo播放器出现问题, Flowplayer 。 我已将以下行添加到我的web.config中,它启用了压缩,但我的flv文件也被gzip压缩: 我试图将以下内容添加到我的web.config中,但它没有改变任何东西: 我必须为flv文件关闭doDynamicCompression而不是gzip压缩。 我认为它将flv文件视为动态内容,因为我在web.config中运行了AllManagedModulesForAllRequests =“true”(我需要处理路由中的一些事情)。 总之,如何禁用flv文件的gzip压缩?

无法找到WCF数据服务类型

我正在尝试将VSCF10中托管的WCF数据服务移动到开发Web服务器。 当我将代码移动到IIS7应用程序时,我收到此错误: 无法找到类型’Aaa.Bbb.Services.ZzzEntities’,作为ServiceHost指令中的Service属性值提供,或在配置元素system.serviceModel / serviceHostingEnvironment / serviceActivations中提供。 ZzzEntities.svc ZzzEntities.svc.cs using Aaa.Bbb.Domain.Entities; using System.Data.Services; using System.Data.Services.Common; using System.ServiceModel.Web; namespace Aaa.Bbb.Services { public class ZzzEntities:DataService { public static void InitializeService(DataServiceConfiguration config) { config.UseVerboseErrors = true; config.SetEntitySetAccessRule(“*”, EntitySetRights.All); config.SetServiceOperationAccessRule(“*”, ServiceOperationRights.All); config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3; } } } 编辑 :此外, Aaa.Bbb.Services.dll已编译并在IIS7 Web应用程序的\ bin目录中。 编辑 :按照这里的说明,我在尝试创建ZzzEntities实例时收到以下错误 – System.TypeLoadException:无法从程序集’Aaa.Bbb.Services,Version = 1.0.0.0,Culture = […]

如何从浏览器调用WCF服务OperationContract?

我创建了一个WCF 4 Web服务并将其托管在我的IIS 7 ,我提供了以下Service URL:在WCF项目的发布Web部分: http://localhost:8084/service1.svc 。 然后我将我发布的web site绑定在端口: 4567并在IIS键入: http 。 To checked it i clicked on `web site` at `IIS` and click on the browse. It open a following page at my browser: 这意味着Web服务已成功托管在IIS 。 现在我想调用我的实例方法并在浏览器中返回输出。 让我粘贴Iservice.cs和service.svc.cs的示例代码 #Iservice.cs: namespace some.decryption { [ServiceContract] public interface Iservice { [OperationContract, WebInvoke(Method = “GET”, UriTemplate = […]

IIS 7.0与7.5站点Microsoft.Web.Administration.Site BindingCollection

我编写了一个程序,它接受主机名和站点名列表,如果它们在任何站点上都不存在,则将它们添加为站点绑定。 该程序是用.NET 4.0 C#编写的。 在本地(IIS 7.5,Win 7),下面的代码工作正常。 它检测绑定并退出。 在我的服务器(IIS 7.0,Win Server 2008)上,检查失败,并始终添加绑定。 是什么赋予了? LINQ查询是错误的还是Microsoft.Web.Administration库有一些处理IIS 7.0的基本不足之处? 以下是应该在两台机器上运行的代码的一部分: ServerManager oIisMgr = new ServerManager(); Site oSite = oIisMgr.Sites[siteName]; string sBindInfo = “:80:” + this.StripUrl(hostName); //See if this binding is already on some site if (oIisMgr.Sites .Where(ST => ST.Bindings.Where(B => B.BindingInformation == sBindInfo).Any()) .Any()) return true; Binding oBinding = […]

使用ServerManager.OpenRemote远程连接到IIS7

我正在尝试使用ServerManager.OpenRemote(“[IP Address]”)连接到IIS7 +。 我正在从HyperV主机连接到其客户端虚拟机。 我不断收到以下错误:’System.Runtime.InteropServices.COMException:RPC服务器不可用。 (来自HRESULT的exception:0x800706BA)’。 我可以使用通过管理服务(客户端)连接的IIS管理器(服务器)连接到客户端的IIS。 由于我无法使用服务器管理器进行连接,我猜测管理服务使用HTTP而ServerManager使用COM进行连接。 有人可以引导我朝正确的方向指导我如何允许这种远程连接吗? 编辑:我已使用netmonvalidation了2台计算机之间的DCOM通信。 我对客户端机器“DCOM:RemoteGetClassObject Request”和“DCOM:RemoteGetClassObject Response”进行了以下描述。 响应在描述中也有“ORPCFNULL”,它向我指示客户端无法找到所请求的COM对象。 任何人都可以validation吗?