首页 > 解决方案 > 当我更改实时服务器 asp.net 上的根目录时,我的 Web 服务页面未运行

问题描述

当我在实时服务器中更改项目的根目录时,我的 Web 服务页面无法正常工作。

我使用的第一个目录是

       https://ezitasker.com/App/Allporject.asmx 

这工作正常。现在我只是将我的根目录更改为https://ezitasker.com/cp/App/Allproject.asmx. 现在我的所有项目文件都可以正常工作,除了引发错误的 asmx 文件:

无法创建类型“Time_Doctor_WebApp.App.Allproject”。

第 1 行:<%@ WebService Language="C#" Codebehind="Allproject.asmx.cs" Class="Time_Doctor_WebApp.App.Allproject" %>

源文件:/Cp/App/allproject.asmx 行:1

版本信息:Microsoft .NET Framework 版本:4.0.30319;ASP.NET 版本:4.7.3690.0

代码隐藏文件是:

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Script.Serialization;
using System.Web.Services;

namespace Time_Doctor_WebApp.App
{
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class Allproject : System.Web.Services.WebService
    {
        [webmethod]
    }

我搜索了很多东西,但没有得到任何帮助。更改到以前的根目录可以完美地工作,但我需要在新的根目录中处理我的文件。

谁能帮我?

标签: c#asp.net

解决方案


再看看错误——问题出在 asmx 文件中:

Source File: /Cp/App/allproject.asmx Line: 1

检查 asmx 文件的第一行并确保CodeBehind="..."仍然指向正确的位置。


推荐阅读