虚拟路径“/”映射到另一个应用程序,这是不允许的

时间:2022-08-02 09:25:32

I've an application developed in Asp.NET MVC, and I'm using the Framework Postal MVC, that is used to send Views as E-mail.

我在Asp.NET MVC中开发了一个应用程序,我正在使用Framework Postal MVC,它用于发送视图作为电子邮件。

It was working properly, without problem, however, today, started to show me the following message:

它运行正常,没有问题,但今天开始向我展示以下信息:

The virtual path '/' maps to another application, which is not allowed.

虚拟路径“/”映射到另一个应用程序,这是不允许的。

It happens only when I try to use SendAsync (async method to send e-mail), however, it was working before without problem. Furthermore, if I use Send (sync method to send e-mail) it work.

它只在我尝试使用SendAsync(异步方法发送电子邮件)时才会发生,但它之前没有问题。此外,如果我使用发送(同步方法发送电子邮件)它工作。

I didn't change anything on the Properties, code, etc.

我没有在属性,代码等方面做任何改动。

The most important thing that I've done that I remember, was to Publish the application, but, in the code or configuration, I didn't change nothing more.

我记得最重要的事情是发布应用程序,但是,在代码或配置中,我没有更改。

It looks like that is losing the HttpContext when doing Async.

看起来在执行Async时会丢失HttpContext。

-- The Async method started to work again when I added the following parameter in my Web.config:

- 当我在Web.config中添加以下参数时,Async方法又开始工作了:

<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />

1 个解决方案

#1


0  

Likewise it was working for me as well and all of a sudden I started getting that error on async AJAX methods. So apparently I was copying out the entire folder which is wrong ... but it worked for weeks on end because prior to that, it was deployed correctly (using the Publish method). But somehow it started realising I wasn't publishing (I think I changed many times in a short period of time) and started showing the error.

同样它也适合我,突然间我开始在异步AJAX方法上得到错误。所以显然我正在复制整个文件夹,这是错误的...但它已经工作了几个星期,因为在此之前,它已正确部署(使用Publish方法)。但不知怎的,它开始意识到我没有发布(我想我在很短的时间内改变了很多次)并开始显示错误。

The fix was to simply deploy correctly using the Publish method. After that it works without the web.config fix mentioned above for aspnet:UseTaskFriendlySynchronizationContext (which goes under <appsettings>).

修复是使用Publish方法正确部署。之后它没有上面提到的针对aspnet的web.config修复工作:UseTaskFriendlySynchronizationContext(在 下)。

#1


0  

Likewise it was working for me as well and all of a sudden I started getting that error on async AJAX methods. So apparently I was copying out the entire folder which is wrong ... but it worked for weeks on end because prior to that, it was deployed correctly (using the Publish method). But somehow it started realising I wasn't publishing (I think I changed many times in a short period of time) and started showing the error.

同样它也适合我,突然间我开始在异步AJAX方法上得到错误。所以显然我正在复制整个文件夹,这是错误的...但它已经工作了几个星期,因为在此之前,它已正确部署(使用Publish方法)。但不知怎的,它开始意识到我没有发布(我想我在很短的时间内改变了很多次)并开始显示错误。

The fix was to simply deploy correctly using the Publish method. After that it works without the web.config fix mentioned above for aspnet:UseTaskFriendlySynchronizationContext (which goes under <appsettings>).

修复是使用Publish方法正确部署。之后它没有上面提到的针对aspnet的web.config修复工作:UseTaskFriendlySynchronizationContext(在 下)。