我刚刚将其他项目页面及其dll集成到我现有项目的Bin /文件夹中。我的项目框架是3.5。当我尝试构建项目或解决方案时,它会抛出以下错误:
“类型'ASP.global_asax'存在于'c:\ Windows \ Microsoft.NET \ Framework \ v2.0.50727 \ Temporary ASP.NET Files \ timesheet \ 15a75c54 \ 898b48b9 \ assembly \ dl3 \ 58b062b2 \ 00ceda54_c98cc801 \ App_global.asax.DLL'和'c:\ Windows \ Microsoft.NET \ Framework \ v2.0.50727 \ Temporary ASP.NET Files \ timesheet \ 15a75c54 \ 898b48b9 \ App_global.asax.q_h6dbfx.dll'c:\ Windows \ Microsoft。 NET \ Framework \ v2.0.50727 \ Temporary ASP.NET Files \ timesheet \ 15a75c54 \ 898b48b9 \ App_Web_admin.master.fdf7a39c.zecazgwd.0.cs “
将“batch = false”设置为web.config不起作用。我还试图删除“c:\ Windows \ Microsoft.NET \ Framework \ v2.0.50727 \ Temporary ASP.NET Files \”中的所有文件夹,然后清理并重建灵魂。但它仍然不起作用。
答案 0 :(得分:124)
在我的情况下,问题发生在虚拟应用程序的bin文件夹中。查看此bin文件夹,您可能会看到两个文件(我发现here的信息):
删除这些可以解决错误。 App_global.asax.dll也是在运行时生成的,这会导致问题。然而,我仍在调查这些文件是如何到达那里的,所以绝对欢迎评论!
答案 1 :(得分:11)
我建议您转到路径:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
并清除应用程序的所有临时文件,构建解决方案,然后运行它!
答案 2 :(得分:6)
在我的情况下,问题是由意外删除“PrecompiledApp.config”引起的。我一返回文件就一切正常。
答案 3 :(得分:3)
在找到一个有效的解决方案之前,我在VS2013中的.NET 4.5中遇到了这个问题一段时间了:
bin
- 文件夹的内容。清洁/重建不足。它显然没有删除足够的;)在web.config的batch="false"
- 元素中添加compilation
属性后,错误仍然存在。
删除ASP.Net Temporary Files
目录也没有帮助。
答案 4 :(得分:1)
对于我来说,要解决该问题,我需要禁用“ PrecompileBeforePublish”并删除bin文件夹,如下图所示。
答案 5 :(得分:1)
就我而言,我在文件夹bin中添加了一个名称为 “ App_global.asax.compiled” 仅删除此文件及其工作。
答案 6 :(得分:0)
答案 7 :(得分:0)
将站点从调试PC发布到服务器时,最近出现了相同的错误。 将选项更改为true可以解决此问题。
protected def processFileForBulkPositionAssignments(file: String, jobDetails: GetJobDetails, resultDocumentId: String) = {
convertCsvLinesStringToBulkImportPositionByUserId(file) match {
case Left(error) => log.info(s"BulkUploadPositionJobService :: performBulkUploadUserPositions :: " +
s"errorMessage from convertCsvLinesStringToJsonList ${error}")
updateJobStatus(jobDetails, None, None, FAILED_STATUS, None, None) //file could not be converted to json
case Right(bulkImportDetails) => log.info(s"JSON STRING LIST IS :: ${bulkImportDetails}")
// TODO: the json string list will contain the same number of lines as present in the document blob
// TODO: process the lines as per the batch-size defined in the config file
val bulkImportDetailBatches = bulkImportDetails.grouped(pagesize).toList
log.info(s"BulkUploadPositionJobService :: processFileForBulkPositionAssignments :: " +
s"total batches are :: ${bulkImportDetailBatches.size}, with batch-size :: ${pagesize}")
bulkImportDetailBatches.map { bulkImportDetailBatch =>
(authorizeActor ? GetClientCredentialsAccessTokenRequest()).mapTo[GetClientCredentialsAccessTokenResponse].map {
_.accessTokenResponse match {
case Left(error) => log.info(s"BulkUploadPositionJobService :: processFileForBulkPositionAssignments :: " +
s"errorMessage from authorizeActor ${error}")
updateJobStatus(jobDetails, None, None, FAILED_STATUS, None, None) //Error in access token generation
case Right(token) =>
log.info("ACCESS TOKEN FOUND AND IS CORRECT ...........")
bulkImportDetailBatch.map{ userPositionMappingDetail =>
(bulkPositionActor ? CreateBulkPositionRequest(token, userPositionMappingDetail)).mapTo[CreateBulkPositionResponse].map {
response => response.creationResponse match {
case Left(error) =>
case Right(message) =>
}
}
}
}
}
}
}
}
package mcc.identity.adminbatch.actor
import akka.actor.{Actor, ActorRef}
import akka.http.scaladsl.Http
import akka.http.scaladsl.model._
import akka.http.scaladsl.model.headers.{Authorization, OAuth2BearerToken}
import akka.stream.scaladsl.{Flow, Sink}
import akka.stream.{ActorMaterializer, ActorMaterializerSettings}
import akka.util.ByteString
import com.typesafe.scalalogging.Logger
import mcc.identity.adminbatch.HttpServer
import mcc.identity.adminbatch.model.PositionRouteModel.BulkImportPositionByUserId
import mcc.identity.adminbatch.model.RouteModel.{ErrorDetails, ErrorMessage}
import mcc.identity.adminbatch.util.BatchConstants
import org.json4s.DefaultFormats
import org.json4s.jackson.Json
import org.json4s.jackson.JsonMethods.{compact, parse, render}
import org.slf4j.LoggerFactory
import scala.concurrent.Future
object BulkPositionActor {
case class CreateBulkPositionRequest(accessToken: OAuth2BearerToken, addUserPositionDetails : BulkImportPositionByUserId)
case class CreateBulkPositionResponse(creationResponse: Either[ErrorMessage, String])
}
class BulkPositionActor extends Actor {
import BulkPositionActor._
import context.dispatcher
implicit val materializer: ActorMaterializer = ActorMaterializer(ActorMaterializerSettings(context.system))
val http = Http(context.system)
implicit val system = HttpServer.system
lazy val log: Logger = Logger(LoggerFactory.getLogger(getClass.getName))
val toSender = sender
override def preRestart(reason: Throwable, message: Option[Any]): Unit = {
log.error(s"BulkPositionActor restarted ${message.getOrElse("")}", reason)
}
def receive: Receive = {
case request: CreateBulkPositionRequest => addUserPositionMapping(sender, request)
}
val host = "localhost"//EnvironmentService.getValue(HttpServerHost)
val port = 9005 //Integer.parseInt(EnvironmentService.getValue(HttpServerPort))
val connectionFlow: Flow[HttpRequest, HttpResponse, Future[Http.OutgoingConnection]] = Http().outgoingConnection(host, port)
//val poolClientFlow = Http().cachedHostConnectionPool[HttpRequest](host, port)
// val poolClientFlow : Flow[(HttpRequest, Int), (Try[HttpResponse], Int), Http.HostConnectionPool] =
// Http().cachedHostConnectionPool[Int](host, port, ConnectionPoolSettings(system))
// def performRequest(request: HttpRequest): Future[HttpResponse] =
// Source
// .single(request)
// .via(connectionFlow)
// .mapAsync(1) {
// case (response, _) =>
// Future.fromTry(response)
// }
// .runWith(Sink.head)
//
// def performRequest(request: HttpRequest): Future[HttpResponse] =
// Source
// .single(request)
// .via(connectionFlow)
// .mapAsync(1) {
// case (response, _) =>
// Future.fromTry(response)
// }
// .runWith(Sink.head)
// val pool: Flow[(HttpRequest, Int), (Try[HttpResponse], Int), Http.HostConnectionPool] =
// Http().cachedHostConnectionPool[Int](host, port, ConnectionPoolSettings(system))
//
// def pooledRequest(req: HttpRequest): Future[HttpResponse] = {
// val unique = 123
// Source.single(req -> unique).via(pool).runWith(Sink.head).flatMap {
// case (Success(r: HttpResponse), `unique`) ⇒ Future.successful(r)
// case (Failure(f), `unique`) ⇒ Future.failed(f)
// case (_, i) ⇒ Future.failed(new Exception("Return does not match the request"))
// }
// }
def createUploadRequest(accessToken: OAuth2BearerToken, addUserPositionDetails: BulkImportPositionByUserId) = {
HttpRequest(
uri = Uri(BatchConstants.idamAdminServicesForCreateUserPositionMapping + s"/${addUserPositionDetails.userId.getOrElse("")}/positions"),
method = HttpMethods.POST,
headers = List(Authorization(accessToken)),
entity = HttpEntity.apply(ContentTypes.`application/json`, Json(DefaultFormats).write(Array(addUserPositionDetails))),
protocol = HttpProtocols.`HTTP/1.1`)
}
protected def addUserPositionMapping(sender: ActorRef, request: CreateBulkPositionRequest) = {
http.singleRequest(
HttpRequest(
uri = Uri(BatchConstants.idamAdminServicesForCreateUserPositionMapping + s"/${request.addUserPositionDetails.userId.getOrElse("")}/positions"),
method = HttpMethods.POST,
headers = List(Authorization(request.accessToken)),
entity = HttpEntity.apply(ContentTypes.`application/json`, Json(DefaultFormats).write(Array(request.addUserPositionDetails))),
protocol = HttpProtocols.`HTTP/1.1`)
) flatMap { response =>
log.info(s"RESPONSE IS :: --------- ${response}")
response.status.intValue() match {
case StatusCodes.MultiStatus.intValue =>
response.entity.dataBytes.runWith(Sink.fold(ByteString.empty)(_ ++ _)).map(_.utf8String).map { result =>
val parsedJson = parse(result.replaceAll("\\\\", "")) \ "results"
compact(parsedJson \\ "status").toInt match {
case StatusCodes.OK.intValue =>
log.info(s"BulkPositionActor :: addUserPositionMapping :: request was successful :: ${compact(parsedJson \\ "message")} , " +
s"for position ${request.addUserPositionDetails}")
sender ! CreateBulkPositionResponse(Right(compact(parsedJson \\ "message")))
case StatusCodes.InternalServerError.intValue =>
log.info(s"BulkPositionActor :: addUserPositionMapping :: $parsedJson")
sender ! CreateBulkPositionResponse(Left(ErrorMessage(compact(parsedJson \\ "status").toInt, StatusCodes.InternalServerError.reason, Seq())))
case other => log.info(s"BulkPositionActor :: addUserPositionMapping :: request failed :: $parsedJson")
sender ! CreateBulkPositionResponse(Left(ErrorMessage(compact(parsedJson \\ "status").toInt, StatusCodes.getForKey(other).get.reason,
Seq(ErrorDetails(compact(render(parsedJson)), compact(parsedJson \\ "errorMessage").replaceAll("\"", ""))))))
}
}
case others =>
Future.successful(sender ! CreateBulkPositionResponse(Left(ErrorMessage(others, "Response Invalid",
Seq(ErrorDetails("response message",response.entity.dataBytes.runWith(Sink.fold(ByteString.empty)(_ ++ _))
.map(_.utf8String).map(res => res).toString))))))
}
}
}.recover {
case ex: Exception =>
log.error("Failed", ex)
sender ! CreateBulkPositionResponse(Left(ErrorMessage(500,
"Internal Server Error", Seq(ErrorDetails("Something went wrong", "Could not fetch access token")))))
}
}
文件〜\ Properties \ PublishProfiles \ FolderProfile.pubxml
答案 8 :(得分:0)
我的问题是我在.net Framework项目中引用了.net标准项目,但不确定它在哪里发生冲突。
答案 9 :(得分:0)
我只是Clean Solution
和Build Solution
然后解决了!
答案 10 :(得分:0)
对我有用的是
删除 TARGET BIN 文件夹或完全清空该文件夹,然后放入最新版本的 BIN 文件夹。
为什么:在我的情况下,在将 BIN 文件夹发布到我的“托管提供商”FTP 服务器后,BIN 文件夹没有覆盖在这种情况下不需要存在的文件 App_global.asax.dll App_global.asax.compiled
通过覆盖整个 BIN 文件夹,我们确保 BIN 文件夹是全新的
这对我有用...