Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# &引用;无法在Outlook中验证或添加Internet日历。”;在动态生成文件时_C#_Asp.net Mvc_Outlook_Icalendar - Fatal编程技术网

C# &引用;无法在Outlook中验证或添加Internet日历。”;在动态生成文件时

C# &引用;无法在Outlook中验证或添加Internet日历。”;在动态生成文件时,c#,asp.net-mvc,outlook,icalendar,C#,Asp.net Mvc,Outlook,Icalendar,我创建了一个MVC应用程序日历,可以根据用户的唯一ID动态生成.ics文件,并将这些文件作为响应发送 代码: [RoutePrefix("iCalendar")] public class OnlineCalendarController : Controller { [Route("{calendarId}")] public FileResult ReturnFile(string calendarId) { // code generating calend

我创建了一个MVC应用程序日历,可以根据用户的唯一ID动态生成.ics文件,并将这些文件作为响应发送

代码:

[RoutePrefix("iCalendar")]
public class OnlineCalendarController : Controller {
    [Route("{calendarId}")]
    public FileResult ReturnFile(string calendarId) {
        // code generating calendar file using iCalendar library
        return new fileStreamResult(new MemoryStream(calendarBytes), "text/calendar");
    }
}
向用户提供与此链接类似的链接:

只要用户通过浏览器打开此链接,就会生成文件并提供下载

我面临的问题是,一旦用户尝试将此链接添加到Outlook,就会抛出以下错误

错误

无法在Outlook中验证或添加Internet日历。验证 链接是有效的日历链接:


有没有办法,如何提供链接,在不将文件保存在db或应用程序的服务器端的情况下动态生成ics文件?

在使用Fiddler时发出请求,并将标题与有效的请求进行比较。可能是内容配置使Outlook无法运行。@CodeCaster您能解释一下具体操作方法吗?请检查请求。@CodeCaster好的,我可以捕获文件请求并响应浏览器,但我甚至无法捕获Outlook的请求。他们有没有办法确定outlook是否发送请求?因为它似乎不使用
localhost.fiddler
来捕获对localhost的请求。在使用fiddler时发出请求,并将头与有效的请求进行比较。可能是内容配置使Outlook无法运行。@CodeCaster您能解释一下具体操作方法吗?请检查请求。@CodeCaster好的,我可以捕获文件请求并响应浏览器,但我甚至无法捕获Outlook的请求。他们有没有办法确定outlook是否发送请求?因为它似乎没有使用
localhost.fiddler
来捕获对localhost的请求。