The type cannot be created after ashx is deleted by mistake, and ashx cannot be created by mistake.
Description
Today, because of temporary issues, you need to take a trip to other cities, and the project is quite busy. So I can only continue Typing Code in the car. The unlucky touchpad allows me to accidentally delete a general ashx handler. The code for this file is still very long.
My approach is to [recycle bin] → [restore] → [Include in project] In ]. Thought it was done.
Then the error message "failed to create type..." appears ......
"/" Indicates a server error in the application.
Analyzer Error
Note:An error occurred while analyzing the resources required to provide services to this request. Check the following detailed analysis error information and modify the source file as appropriate.
Analyzer error message:The "Shop. Web. admin. SiteController" type cannot be created ".
Source error:
Row 1: <% @ WebHandler Language = "C #" CodeBehind = "SiteController. ashx. cs" Class = "Shop. Web. admin. SiteController" %>
Source file:/Admin/SiteController. ashxRow:1
Version:Microsoft. NET Framework Version: 4.0.30319; ASP. NET version: 4.0.30319.34248
Rough experience
I have found many posts on the Internet, but it is not necessary. It seems that none of them match. Later, I ran to the MSDN developer community. I saw this scene.
It can be said that my heart collapsed when I saw this scene.
Solution
Later, I had a hard time thinking. I think so.
[Failed to create type] It must be because of my type, which has already appeared in the Assembly. All I have to do is clear the compiled results.
Then I found the local folder of the website and deleted all files under [obj] → [Debug. Then re-compile and F5 start debugging.
OK ~~~~