使用以下说明在Ubuntu上安装Mono 2.4:http: //www.nabble.com/forum/PrintPost.jtp?post = 22841086
当我运行xsp并尝试运行http模块(http://192.168.1.6:8080/album.ashx)时,我收到以下错误:
Compilation Error Description: Error compiling a resource required to service this request. Review your source file and modify it to fix this error. Compiler Error Message: /tmp/fredf-temp-aspnet-0/e8a60863/194d0e44.cs(479,18) : error CS1644: Feature `generics' is not available in Mono mcs1 compiler. Consider using the `gmcs' compiler instead /tmp/fredf-temp-aspnet-0/e8a60863/194d0e44.cs(479,50) : error CS1644: Feature `generics' is not available in Mono mcs1 compiler. Consider using the `gmcs' compiler instead
我该如何解决这个错误?
非常简单的问题..服务图像更好的是web.net服务或asp.net c#中的HttpHandler?
有什么不同 ?为什么我更喜欢一个而不是另一个?
谢谢
我正在尝试使用JQuery Autocomplete,但我想我无法从我的处理程序中获取它所期望的格式.
这是处理程序的作用.这是另一个SO问题....
context.Response.ContentType = "text/plain";
var companies = GetCompanies(); //This returns a list of companies (List<string>)
foreach (var comp in companies)
{
context.Response.Write(comp + Environment.NewLine);
}
Run Code Online (Sandbox Code Playgroud)
这不起作用.它肯定会被调用,它会返回我希望此代码返回的内容.有任何想法吗?
令我好奇的是,当我在Visual Studio ASP.NET开发服务器中运行Web应用程序时,通用处理程序工作得很好.当我更改配置以直接从IIS运行它时,处理程序就会死掉.
我真的不是这方面的专家,所以对我很不满意.
它是一个图像处理程序,它会写回要在Image对象中呈现的字节数组.正如我所说,它在VS Development Server中运行良好,但在IIS上失败.它甚至没有被称为......
我试图直接调用它时得到的错误是:
分析程序错误说明:解析为此请求提供服务所需的资源时发生错误.请查看以下特定的解析错误详细信息并相应地修改源文件.分析器错误消息:无法创建类型'YourImageHandler'.源错误:第1行:<%@ WebHandler语言="C#"CodeBehind ="YourImagehandler.ashx.cs"Class ="YourImageHandler"%>
有任何想法吗?
编辑:
更多信息:
web.config上的处理程序:
<system.web>
<httpHandlers>
<add verb="*" path="*.ashx" type="YourImageHandler"/>
</httpHandlers>
</system.web>
Run Code Online (Sandbox Code Playgroud)
Generic Handler与Web项目位于同一个程序集中,整个过程在IIS 7上运行.
当我将此代码添加到我的时候aspx,
<telerik:RadEditor ID="REWelcome" runat="server"
AutoResizeHeight="True" Width="500px" ToolbarMode="Floating">
<Content>
</Content>
<TrackChangesSettings CanAcceptTrackChanges="False"></TrackChangesSettings>
</telerik:RadEditor>
Run Code Online (Sandbox Code Playgroud)
我收到此错误消息,
'~/Telerik.Web.UI.WebResource.axd' is missing in web.config.
RadScriptManager requires a
HttpHandler registration in web.config.
Run Code Online (Sandbox Code Playgroud)
我该如何解决?
有很多问题可以回答这个问题,但没有一个答案对我有用。
最初,当我尝试PUTor DELETE (也可能是其他动词)时,我得到了 405 。看了一些问题,解决方案似乎是更改处理程序映射。
我更改了以下内容:
ExtensionlessUrlHandler-ISAPI-4.0_32bit
ExtensionlessUrlHandler-ISAPI-4.0_64bit
WebDAV
Run Code Online (Sandbox Code Playgroud)
我注意到动词已经在One of the following verbs盒子里了,所以无奈之下我把它改成接受所有动词。
现在,我什至无法加载网页,更不用说发出任何像 一样奇特的请求DELETE,我立即得到一个黄屏死机:
Server Error in '/' Application.
Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
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.TypeLoadException: Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly …Run Code Online (Sandbox Code Playgroud) 我正在使用html表单的onload方法注册一个函数,我需要在卸载表单时取消注册此事件的hander函数.我如何在Internet Explorer 6中执行此操作?
添加和删除处理程序有什么区别?
在我使用VS2008创建的新Web项目中,处理程序的定义如下:
<system.web>
...
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
<add verb="*" path="/hello/helloworld.xml" type="HandlerTest.HelloWorldHandler, HandlerTest"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
</system.web>
Run Code Online (Sandbox Code Playgroud)
但是在预先存在的项目中(即:社区服务器),http处理程序的添加/删除如下:
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<security>
<requestFiltering allowDoubleEscaping="true"/>
</security>
<modules runAllManagedModulesForAllRequests="true">
<remove name="CommunityServer"/>
<remove name="ScriptModule"/>
<remove name="UrlRoutingModule"/>
<add name="CommunityServer" type="CommunityServer.CSHttpModule, CommunityServer.Components"/>
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add …Run Code Online (Sandbox Code Playgroud) 我需要在我的Handler.ashx文件中创建一个临时文件(new.txt),但问题是我将创建的excel文件保存在new.txt中作为临时文件.问题在这里我将临时文件硬编码为" new.txt".如果不止一个用户访问同一个应用程序会发生什么.如何克服这个问题.我们可以使用线程.
示例代码..
if (File.Exists(context.Server.MapPath("new.txt")))
{
File.Delete(context.Server.MapPath("new.txt"));
xlWorkBook.SaveAs(context.Server.MapPath("new.txt"), Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
}
if (!File.Exists(context.Server.MapPath("new.txt")))
{
xlWorkBook.SaveAs(context.Server.MapPath("new.txt"), Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
}
string file = context.Server.MapPath("new.txt");
byte[] myByte = File.ReadAllBytes(file);
File.Delete(context.Server.MapPath("new.txt"));
context.Response.Clear();
context.Response.BinaryWrite(myByte);
context.Response.Flush();
context.Response.Close();
Run Code Online (Sandbox Code Playgroud) 我有一个在Windows Server 2003(x86)上运行的IIS6,并编写了一个自定义处理程序(不是404错误的处理程序).
当我尝试通过在浏览器http://localhost/Priority1.Sync/Transfer.p1s中打开来访问处理程序时,我得到错误404(日志文件中为404 0).Web应用程序中的其他页面可以工作,例如http://localhost/priority1.sync/syncservice.asmx
处理程序在我的IIS7开发机器上正常工作.
web.config的设置如下:
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*.p1s" type="MCS.Priority1.Sync.WebServices.TransferHandler, SyncService" />
</httpHandlers>
Run Code Online (Sandbox Code Playgroud)
我为"*.p1s"设置了应用程序扩展(默认网站>属性>主目录>配置>映射>添加).
我错过了别的什么吗?
谢谢,安迪
我正在我的MVC 3应用程序中实现javascript文件上传功能,因此我需要使用Http Handler(.ashx)来允许大文件上传.现在我需要以某种方式禁止未经身份验证的用户调用处理程序的方法.如果我有一个控制器,我只需要申请[授权].但是当应用于Http Handler的方法时,该属性是否有效?如果没有,我怎样才能只允许拥有当前会话cookie的人拨打Http Handler?
httphandler ×11
asp.net ×8
c# ×5
web-config ×2
.net ×1
asp.net-mvc ×1
autocomplete ×1
events ×1
handler ×1
iis-6 ×1
iis-8 ×1
javascript ×1
jquery ×1
mono ×1
radeditor ×1
security ×1
telerik ×1
web-services ×1