Asp net ошибка синтаксического анализатора

I’ve finished simple asp.net web application project, compiled it, and try to test on local IIS. I’ve create virtual directory, map it with physical directory, then put all necessary files there, including bin folder with all .dll’s
In the project settings, build section, output path is bin
So when i try to browse my app i got:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Parser Error 
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Could not load type 'AmeriaTestTask.Default'.

Source Error: 


Line 1:  <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AmeriaTestTask.Default" %>
Line 2:  
Line 3:  <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>


Source File: /virtual/default.aspx    Line: 1 

enter image description here

Have read similar problem posts and solution was to set output path to bin, but it is defalut for my project.

asked Feb 10, 2013 at 17:36

igorGIS's user avatar

9

I know i am too late to answer but it could help others and save time.

Following might be other solutions.

Solution 1: See Creating a Virtual Directory for Your Application for detailed instructions on creating a virtual directory for your application.

Solution 2: Your application’s Bin folder is missing or the application’s DLL file is missing. See Copying Your Application Files to a Production Server for detailed instructions.

Solution 3: You may have deployed to the web root folder, but have not changed some of the settings in the Web.config file. See Deploying to web root for detailed instructions.

In my case Solution 2 works, while deploying to server some DLL's from bin directory has not been uploaded to server successfully. I have re-upload all DLL’s again and it works!!

Here is the reference link to solve asp.net parser error.

answered Jan 23, 2014 at 8:46

immayankmodi's user avatar

immayankmodiimmayankmodi

8,1209 gold badges36 silver badges55 bronze badges

0

I had the same issue. Ran 5 or 6 hours of researches. A simple solution seems to be working. I just had to convert my folder to application from iis. It worked fine. (this was a scenario where I had done a migration from server 2003 to server 2008 R2)

(1) Open IIS and select the website and the appropriate folder that needs to be converted. Right-click and select Convert to Application.

enter image description here

answered Sep 13, 2014 at 6:20

Aravinda's user avatar

AravindaAravinda

4951 gold badge7 silver badges17 bronze badges

3

Try changing CodeBehind="Default.aspx.cs" to CodeFile="Default.aspx.cs"

answered Jun 16, 2016 at 6:39

Codeone's user avatar

CodeoneCodeone

1,1732 gold badges15 silver badges40 bronze badges

Sometimes it happens if you either:

  1. Clean solution/build or,
  2. Rebuild solution/build.

If it ‘suddenly’ happens after such, and your code has build-time errors then try fixing those errors first.

What happens is that as your solution is built, DLL files are created and stored in the projects bin folder. If there is an error in your code during build-time, the DLL files aren’t created properly which brings up an error.

A ‘quick fix’ would be to fix all your errors or comment them out (if they wont affect other web pages.) then rebuild project/solution

If this doesn’t work then try changing:
CodeBehind=»blahblahblah.aspx.cs»

to:
CodeFile=»blahblahblah.aspx.cs»

Note: Change «blahblahblah» to the pages real name.

answered Sep 14, 2017 at 15:00

Onga Leo-Yoda Vellem's user avatar

I have solved it this way.

Go to your project file let’s say project/name/bin and delete everything within the bin folder. (this will then give you another error which you can solve this way)

then in your visual studio right click project’s References folder, to open NuGet Package Manager.

Go to browse and install «DotNetCompilerPlatform».

answered Sep 19, 2018 at 9:15

Mo D Genesis's user avatar

Mo D GenesisMo D Genesis

4,8751 gold badge21 silver badges30 bronze badges

Faced the same error when I had a programming error in one of the ASHX files: it was created by copying another file, and inherited its class name in the code behind statement. There was no error when all ASPX and ASHX files ran in IIS Express locally, but once deployed to the server they stopped working (all of them).

Once I found that one ASHX page and fixed the class name to reflect its own class name, all ASPX and ASHX files started working fine in IIS.

answered Oct 5, 2016 at 16:17

ajeh's user avatar

ajehajeh

2,6422 gold badges33 silver badges64 bronze badges

Very old question here, but I ran into the same error and none of the provided answers solved the issue.

My issue occurred because I manually changed the namespace and assembly names of the project after initial creation. Took me a little bit to notice that the namespace in the Inherits attribute didn’t match the updated namespace.

Updating that namespace in the Global.asax markup to match the apps namespace fixed the error for me.

answered Oct 16, 2019 at 20:05

A-A-ron's user avatar

A-A-ronA-A-ron

5291 gold badge5 silver badges14 bronze badges

IIS 7 or IIS 8 or 8.5 version — if you are migrating from 2003 to 2012/2008 make sure web service are in application type instead virtual directory

answered Jul 31, 2015 at 9:53

Chandrashekar Gowda's user avatar

0

In my case, There were new code branch and old code branch was deployed locally in IIS. So it was pointing to old branch code that was not available. So i had deployed my code to IIS with new branch and it is working now.

answered Dec 27, 2017 at 14:02

Jeetendra's user avatar

0

In my case I missed the compile tag in the .csproj file

<Compile Include="Global.asax.cs">
  <DependentUpon>Global.asax</DependentUpon>
  <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>

answered Apr 30, 2018 at 10:24

David's user avatar

DavidDavid

70311 silver badges24 bronze badges

Interesting all the different scenarios..

In my case…I had uploaded my site to GoDaddy and was getting the Parser Error.

I resolved it by commenting out compilers under system.codedom in web.config.
And also add a custom profile for publishing that would precompile during publishing.

  <system.codedom>
    <!--GoDaddy does not compile!-->
    <!--<compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=&quot;Web&quot; /optionInfer+" />
    </compilers>-->
  </system.codedom>

answered Apr 4, 2019 at 23:54

Chris Catignani's user avatar

Chris CatignaniChris Catignani

4,93715 gold badges42 silver badges48 bronze badges

When you add subfolders and files in subfolders the DLL files in Bin folder also may have changed. When I uploaded the updated DLL file in Bin folder it solved the issue. Thanks to Mayank Modi who suggested that or hinted that.

answered Jul 31, 2019 at 5:32

Sam Patirage's user avatar

Looking at the error message, part of the code of your Default.aspx is :

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AmeriaTestTask.Default" %>

but AmeriaTestTask.Default does not exists, so you have to change it, most probably to the class defined in Default.aspx.cs. For example for web api aplications, the class defined in Global.asax.cs is : public class WebApiApplication : System.Web.HttpApplication and in the asax page you have :

<%@ Application Codebehind="Global.asax.cs" Inherits="MyProject.WebApiApplication" Language="C#" %>

answered Mar 22, 2020 at 15:08

Mario's user avatar

MarioMario

3132 silver badges11 bronze badges

I am too late but let me explain how I solved this problem.

This problem is basically because of improper folders/solution structure.

this issue may occur because
1. If you have copied project from other location and trying to run the project.

so to resolve this go to original location and crosscheck the folders and files again.

this works for me.

answered Sep 21, 2015 at 6:14

Shriganesh Kolhe's user avatar

After a lot of searching ,i found the problem was in my project dll file .i cleaned and rebuild my project when there were compilation errors …
simple solution is to remove all compilation errors in all pages either by removing contents or commenting lines ,then clean and rebuild your project …
this will sort out your problem ..

answered May 19, 2020 at 18:20

abhishek bhardwaj's user avatar

This happens when the files inside the Debug and Release folder are not created properly(Either they are having wrong reference or having overwritten many times). I have faced the same problem in which, i everything works fine when we build the solution, but when i publish the website it gives me same error.
I have solved this in following manner:

  1. Go to your Solution Explorer in Visual Studio and click on show hidden files (if they are not showing ! )
  2. you will find a folder named obj, open it .
  3. Here there are again 2 folder named respectively as Debug and Release.
    Now, delete the content from these two folder, Make sure that you do not delete the folders Debug and Release. Only delete the files and folders inside Debug and Release folder.
  4. Now build and publish your solution and everything will work like charm.

answered Sep 20, 2015 at 11:08

Roshan Parmar's user avatar

Roshan ParmarRoshan Parmar

3,6921 gold badge11 silver badges7 bronze badges

1

  • Remove From My Forums

 none

Ошибка источника

  • Вопрос

  • Добрый день !

    У меня возникла такая проблема:

    после установки Visual Studio 2010 для ASP.NET MVC4  выдаетя:
    «Сообщение об ошибке синтаксического анализатора: Не удалось загрузить тип ‘My_MVC4.MvcApplication’.
    Ошибка источника:
    Строка 1:<%@ Application Codebehind=»Global.asax.cs» Inherits=»‘My_MVC4.MvcApplication» Language=»C#» %>

    Подскажите пожалуйста, как с этим бороться?

    Заранее благодарен, app.

Ответы

  • My_MVC4.MvcApplication — это ваш класс, определенный в global.asax.cs. Скорее всего у вас просто проект не скопмилирован.
    Запустите свой проект из студии по Ctrl+F5.

    • Помечено в качестве ответа

      8 октября 2012 г. 8:37

  • Привет.

    Нет, врядли дело в настройках. В каком браузере запускается у вас веб-приложение, помоему, только в IE можно отлаживать javascript из Visual Studio. В остальных браузерах — нужно пользоваться их встроенными утилитами для отладки.


    Для связи [mail]

    • Помечено в качестве ответа
      Abolmasov Dmitry
      8 октября 2012 г. 8:37

f7ed8ae85ec344278b80e2c35f189019.png


  • Вопрос задан

    более трёх лет назад

  • 1509 просмотров



1

комментарий


Решения вопроса 1

andrewpianykh

Соответствие пространств имен в Global.asax.cs и Global.asax проверьте. Должно быть GameStore.MvcApplication.

Пригласить эксперта


Ответы на вопрос 2

eRKa

@kttotto

пофиг на чем писать

У Вас в коде Codebehind, а в доках везде CodeBehind. Это может быть причиной?


Комментировать


Похожие вопросы


  • Показать ещё
    Загружается…

21 июн. 2023, в 17:29

600 руб./за проект

21 июн. 2023, в 17:23

2000 руб./за проект

21 июн. 2023, в 16:55

5000 руб./за проект

Минуточку внимания

f7ed8ae85ec344278b80e2c35f189019.png


  • Вопрос задан

    более трёх лет назад

  • 1474 просмотра


1

комментарий


Решения вопроса 1

andrewpianykh

Соответствие пространств имен в Global.asax.cs и Global.asax проверьте. Должно быть GameStore.MvcApplication.

Пригласить эксперта


Ответы на вопрос 2

eRKa

@kttotto

пофиг на чем писать

У Вас в коде Codebehind, а в доках везде CodeBehind. Это может быть причиной?


Комментировать


Похожие вопросы


  • Показать ещё
    Загружается…

08 апр. 2023, в 23:41

3000 руб./за проект

08 апр. 2023, в 20:47

5000 руб./за проект

08 апр. 2023, в 19:16

30000 руб./за проект

Минуточку внимания

  • Remove From My Forums

 none

Ошибка источника

  • Вопрос

  • Добрый день !

    У меня возникла такая проблема:

    после установки Visual Studio 2010 для ASP.NET MVC4  выдаетя:
    «Сообщение об ошибке синтаксического анализатора: Не удалось загрузить тип ‘My_MVC4.MvcApplication’.
    Ошибка источника:
    Строка 1:<%@ Application Codebehind=»Global.asax.cs» Inherits=»‘My_MVC4.MvcApplication» Language=»C#» %>

    Подскажите пожалуйста, как с этим бороться?

    Заранее благодарен, app.

Ответы

  • My_MVC4.MvcApplication — это ваш класс, определенный в global.asax.cs. Скорее всего у вас просто проект не скопмилирован.
    Запустите свой проект из студии по Ctrl+F5.

    • Помечено в качестве ответа

      8 октября 2012 г. 8:37

  • Привет.

    Нет, врядли дело в настройках. В каком браузере запускается у вас веб-приложение, помоему, только в IE можно отлаживать javascript из Visual Studio. В остальных браузерах — нужно пользоваться их встроенными утилитами для отладки.


    Для связи [mail]

    • Помечено в качестве ответа
      Abolmasov Dmitry
      8 октября 2012 г. 8:37

f7ed8ae85ec344278b80e2c35f189019.png


  • Вопрос задан

    более трёх лет назад

  • 1439 просмотров


1

комментарий


Решения вопроса 1

andrewpianykh

Соответствие пространств имен в Global.asax.cs и Global.asax проверьте. Должно быть GameStore.MvcApplication.

Пригласить эксперта


Ответы на вопрос 2

eRKa

@kttotto

пофиг на чем писать

У Вас в коде Codebehind, а в доках везде CodeBehind. Это может быть причиной?


Комментировать


Похожие вопросы


  • Показать ещё
    Загружается…

28 янв. 2023, в 16:38

2500 руб./за проект

28 янв. 2023, в 15:53

3000 руб./за проект

28 янв. 2023, в 15:40

5000 руб./за проект

Минуточку внимания

  • Remove From My Forums

none

Ошибка источника

  • Вопрос

  • Добрый день !

    У меня возникла такая проблема:

    после установки Visual Studio 2010 для ASP.NET MVC4  выдаетя:
    «Сообщение об ошибке синтаксического анализатора: Не удалось загрузить тип ‘My_MVC4.MvcApplication’.
    Ошибка источника:
    Строка 1:<%@ Application Codebehind=»Global.asax.cs» Inherits=»‘My_MVC4.MvcApplication» Language=»C#» %>

    Подскажите пожалуйста, как с этим бороться?

    Заранее благодарен, app.

Ответы

  • My_MVC4.MvcApplication — это ваш класс, определенный в global.asax.cs. Скорее всего у вас просто проект не скопмилирован.
    Запустите свой проект из студии по Ctrl+F5.

    • Помечено в качестве ответа

      8 октября 2012 г. 8:37

  • Привет.

    Нет, врядли дело в настройках. В каком браузере запускается у вас веб-приложение, помоему, только в IE можно отлаживать javascript из Visual Studio. В остальных браузерах — нужно пользоваться их встроенными утилитами для отладки.


    Для связи [mail]

    • Помечено в качестве ответа
      Abolmasov Dmitry
      8 октября 2012 г. 8:37

I’ve finished simple asp.net web application project, compiled it, and try to test on local IIS. I’ve create virtual directory, map it with physical directory, then put all necessary files there, including bin folder with all .dll’s
In the project settings, build section, output path is bin
So when i try to browse my app i got:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Parser Error 
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Could not load type 'AmeriaTestTask.Default'.

Source Error: 


Line 1:  <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AmeriaTestTask.Default" %>
Line 2:  
Line 3:  <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>


Source File: /virtual/default.aspx    Line: 1 

enter image description here

Have read similar problem posts and solution was to set output path to bin, but it is defalut for my project.

asked Feb 10, 2013 at 17:36

igorGIS's user avatar

9

I know i am too late to answer but it could help others and save time.

Following might be other solutions.

Solution 1: See Creating a Virtual Directory for Your Application for detailed instructions on creating a virtual directory for your application.

Solution 2: Your application’s Bin folder is missing or the application’s DLL file is missing. See Copying Your Application Files to a Production Server for detailed instructions.

Solution 3: You may have deployed to the web root folder, but have not changed some of the settings in the Web.config file. See Deploying to web root for detailed instructions.

In my case Solution 2 works, while deploying to server some DLL's from bin directory has not been uploaded to server successfully. I have re-upload all DLL’s again and it works!!

Here is the reference link to solve asp.net parser error.

answered Jan 23, 2014 at 8:46

immayankmodi's user avatar

immayankmodiimmayankmodi

7,8309 gold badges35 silver badges55 bronze badges

0

I had the same issue. Ran 5 or 6 hours of researches. A simple solution seems to be working. I just had to convert my folder to application from iis. It worked fine. (this was a scenario where I had done a migration from server 2003 to server 2008 R2)

(1) Open IIS and select the website and the appropriate folder that needs to be converted. Right-click and select Convert to Application.

enter image description here

answered Sep 13, 2014 at 6:20

Aravinda's user avatar

AravindaAravinda

4951 gold badge7 silver badges16 bronze badges

3

Try changing CodeBehind="Default.aspx.cs" to CodeFile="Default.aspx.cs"

answered Jun 16, 2016 at 6:39

Codeone's user avatar

CodeoneCodeone

1,1482 gold badges15 silver badges39 bronze badges

Sometimes it happens if you either:

  1. Clean solution/build or,
  2. Rebuild solution/build.

If it ‘suddenly’ happens after such, and your code has build-time errors then try fixing those errors first.

What happens is that as your solution is built, DLL files are created and stored in the projects bin folder. If there is an error in your code during build-time, the DLL files aren’t created properly which brings up an error.

A ‘quick fix’ would be to fix all your errors or comment them out (if they wont affect other web pages.) then rebuild project/solution

If this doesn’t work then try changing:
CodeBehind=»blahblahblah.aspx.cs»

to:
CodeFile=»blahblahblah.aspx.cs»

Note: Change «blahblahblah» to the pages real name.

answered Sep 14, 2017 at 15:00

Onga Leo-Yoda Vellem's user avatar

I have solved it this way.

Go to your project file let’s say project/name/bin and delete everything within the bin folder. (this will then give you another error which you can solve this way)

then in your visual studio right click project’s References folder, to open NuGet Package Manager.

Go to browse and install «DotNetCompilerPlatform».

answered Sep 19, 2018 at 9:15

Mo D Genesis's user avatar

Mo D GenesisMo D Genesis

4,5141 gold badge19 silver badges30 bronze badges

Faced the same error when I had a programming error in one of the ASHX files: it was created by copying another file, and inherited its class name in the code behind statement. There was no error when all ASPX and ASHX files ran in IIS Express locally, but once deployed to the server they stopped working (all of them).

Once I found that one ASHX page and fixed the class name to reflect its own class name, all ASPX and ASHX files started working fine in IIS.

answered Oct 5, 2016 at 16:17

ajeh's user avatar

ajehajeh

2,6002 gold badges31 silver badges61 bronze badges

Very old question here, but I ran into the same error and none of the provided answers solved the issue.

My issue occurred because I manually changed the namespace and assembly names of the project after initial creation. Took me a little bit to notice that the namespace in the Inherits attribute didn’t match the updated namespace.

Updating that namespace in the Global.asax markup to match the apps namespace fixed the error for me.

answered Oct 16, 2019 at 20:05

A-A-ron's user avatar

A-A-ronA-A-ron

5291 gold badge4 silver badges14 bronze badges

IIS 7 or IIS 8 or 8.5 version — if you are migrating from 2003 to 2012/2008 make sure web service are in application type instead virtual directory

answered Jul 31, 2015 at 9:53

Chandrashekar Gowda's user avatar

0

In my case, There were new code branch and old code branch was deployed locally in IIS. So it was pointing to old branch code that was not available. So i had deployed my code to IIS with new branch and it is working now.

answered Dec 27, 2017 at 14:02

Jeetendra's user avatar

0

In my case I missed the compile tag in the .csproj file

<Compile Include="Global.asax.cs">
  <DependentUpon>Global.asax</DependentUpon>
  <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>

answered Apr 30, 2018 at 10:24

David's user avatar

DavidDavid

69311 silver badges24 bronze badges

Interesting all the different scenarios..

In my case…I had uploaded my site to GoDaddy and was getting the Parser Error.

I resolved it by commenting out compilers under system.codedom in web.config.
And also add a custom profile for publishing that would precompile during publishing.

  <system.codedom>
    <!--GoDaddy does not compile!-->
    <!--<compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=&quot;Web&quot; /optionInfer+" />
    </compilers>-->
  </system.codedom>

answered Apr 4, 2019 at 23:54

Chris Catignani's user avatar

Chris CatignaniChris Catignani

4,75813 gold badges43 silver badges48 bronze badges

When you add subfolders and files in subfolders the DLL files in Bin folder also may have changed. When I uploaded the updated DLL file in Bin folder it solved the issue. Thanks to Mayank Modi who suggested that or hinted that.

answered Jul 31, 2019 at 5:32

Sam Patirage's user avatar

Looking at the error message, part of the code of your Default.aspx is :

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AmeriaTestTask.Default" %>

but AmeriaTestTask.Default does not exists, so you have to change it, most probably to the class defined in Default.aspx.cs. For example for web api aplications, the class defined in Global.asax.cs is : public class WebApiApplication : System.Web.HttpApplication and in the asax page you have :

<%@ Application Codebehind="Global.asax.cs" Inherits="MyProject.WebApiApplication" Language="C#" %>

answered Mar 22, 2020 at 15:08

Mario's user avatar

MarioMario

3132 silver badges11 bronze badges

I am too late but let me explain how I solved this problem.

This problem is basically because of improper folders/solution structure.

this issue may occur because
1. If you have copied project from other location and trying to run the project.

so to resolve this go to original location and crosscheck the folders and files again.

this works for me.

answered Sep 21, 2015 at 6:14

Shriganesh Kolhe's user avatar

After a lot of searching ,i found the problem was in my project dll file .i cleaned and rebuild my project when there were compilation errors …
simple solution is to remove all compilation errors in all pages either by removing contents or commenting lines ,then clean and rebuild your project …
this will sort out your problem ..

answered May 19, 2020 at 18:20

abhishek bhardwaj's user avatar

This happens when the files inside the Debug and Release folder are not created properly(Either they are having wrong reference or having overwritten many times). I have faced the same problem in which, i everything works fine when we build the solution, but when i publish the website it gives me same error.
I have solved this in following manner:

  1. Go to your Solution Explorer in Visual Studio and click on show hidden files (if they are not showing ! )
  2. you will find a folder named obj, open it .
  3. Here there are again 2 folder named respectively as Debug and Release.
    Now, delete the content from these two folder, Make sure that you do not delete the folders Debug and Release. Only delete the files and folders inside Debug and Release folder.
  4. Now build and publish your solution and everything will work like charm.

answered Sep 20, 2015 at 11:08

Roshan Parmar's user avatar

Roshan ParmarRoshan Parmar

3,6821 gold badge11 silver badges7 bronze badges

1

I’ve finished simple asp.net web application project, compiled it, and try to test on local IIS. I’ve create virtual directory, map it with physical directory, then put all necessary files there, including bin folder with all .dll’s
In the project settings, build section, output path is bin
So when i try to browse my app i got:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Parser Error 
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Could not load type 'AmeriaTestTask.Default'.

Source Error: 


Line 1:  <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AmeriaTestTask.Default" %>
Line 2:  
Line 3:  <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>


Source File: /virtual/default.aspx    Line: 1 

enter image description here

Have read similar problem posts and solution was to set output path to bin, but it is defalut for my project.

asked Feb 10, 2013 at 17:36

igorGIS's user avatar

9

I know i am too late to answer but it could help others and save time.

Following might be other solutions.

Solution 1: See Creating a Virtual Directory for Your Application for detailed instructions on creating a virtual directory for your application.

Solution 2: Your application’s Bin folder is missing or the application’s DLL file is missing. See Copying Your Application Files to a Production Server for detailed instructions.

Solution 3: You may have deployed to the web root folder, but have not changed some of the settings in the Web.config file. See Deploying to web root for detailed instructions.

In my case Solution 2 works, while deploying to server some DLL's from bin directory has not been uploaded to server successfully. I have re-upload all DLL’s again and it works!!

Here is the reference link to solve asp.net parser error.

answered Jan 23, 2014 at 8:46

immayankmodi's user avatar

immayankmodiimmayankmodi

7,8309 gold badges35 silver badges55 bronze badges

0

I had the same issue. Ran 5 or 6 hours of researches. A simple solution seems to be working. I just had to convert my folder to application from iis. It worked fine. (this was a scenario where I had done a migration from server 2003 to server 2008 R2)

(1) Open IIS and select the website and the appropriate folder that needs to be converted. Right-click and select Convert to Application.

enter image description here

answered Sep 13, 2014 at 6:20

Aravinda's user avatar

AravindaAravinda

4951 gold badge7 silver badges16 bronze badges

3

Try changing CodeBehind="Default.aspx.cs" to CodeFile="Default.aspx.cs"

answered Jun 16, 2016 at 6:39

Codeone's user avatar

CodeoneCodeone

1,1482 gold badges15 silver badges39 bronze badges

Sometimes it happens if you either:

  1. Clean solution/build or,
  2. Rebuild solution/build.

If it ‘suddenly’ happens after such, and your code has build-time errors then try fixing those errors first.

What happens is that as your solution is built, DLL files are created and stored in the projects bin folder. If there is an error in your code during build-time, the DLL files aren’t created properly which brings up an error.

A ‘quick fix’ would be to fix all your errors or comment them out (if they wont affect other web pages.) then rebuild project/solution

If this doesn’t work then try changing:
CodeBehind=»blahblahblah.aspx.cs»

to:
CodeFile=»blahblahblah.aspx.cs»

Note: Change «blahblahblah» to the pages real name.

answered Sep 14, 2017 at 15:00

Onga Leo-Yoda Vellem's user avatar

I have solved it this way.

Go to your project file let’s say project/name/bin and delete everything within the bin folder. (this will then give you another error which you can solve this way)

then in your visual studio right click project’s References folder, to open NuGet Package Manager.

Go to browse and install «DotNetCompilerPlatform».

answered Sep 19, 2018 at 9:15

Mo D Genesis's user avatar

Mo D GenesisMo D Genesis

4,5141 gold badge19 silver badges30 bronze badges

Faced the same error when I had a programming error in one of the ASHX files: it was created by copying another file, and inherited its class name in the code behind statement. There was no error when all ASPX and ASHX files ran in IIS Express locally, but once deployed to the server they stopped working (all of them).

Once I found that one ASHX page and fixed the class name to reflect its own class name, all ASPX and ASHX files started working fine in IIS.

answered Oct 5, 2016 at 16:17

ajeh's user avatar

ajehajeh

2,6002 gold badges31 silver badges61 bronze badges

Very old question here, but I ran into the same error and none of the provided answers solved the issue.

My issue occurred because I manually changed the namespace and assembly names of the project after initial creation. Took me a little bit to notice that the namespace in the Inherits attribute didn’t match the updated namespace.

Updating that namespace in the Global.asax markup to match the apps namespace fixed the error for me.

answered Oct 16, 2019 at 20:05

A-A-ron's user avatar

A-A-ronA-A-ron

5291 gold badge4 silver badges14 bronze badges

IIS 7 or IIS 8 or 8.5 version — if you are migrating from 2003 to 2012/2008 make sure web service are in application type instead virtual directory

answered Jul 31, 2015 at 9:53

Chandrashekar Gowda's user avatar

0

In my case, There were new code branch and old code branch was deployed locally in IIS. So it was pointing to old branch code that was not available. So i had deployed my code to IIS with new branch and it is working now.

answered Dec 27, 2017 at 14:02

Jeetendra's user avatar

0

In my case I missed the compile tag in the .csproj file

<Compile Include="Global.asax.cs">
  <DependentUpon>Global.asax</DependentUpon>
  <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>

answered Apr 30, 2018 at 10:24

David's user avatar

DavidDavid

69311 silver badges24 bronze badges

Interesting all the different scenarios..

In my case…I had uploaded my site to GoDaddy and was getting the Parser Error.

I resolved it by commenting out compilers under system.codedom in web.config.
And also add a custom profile for publishing that would precompile during publishing.

  <system.codedom>
    <!--GoDaddy does not compile!-->
    <!--<compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=&quot;Web&quot; /optionInfer+" />
    </compilers>-->
  </system.codedom>

answered Apr 4, 2019 at 23:54

Chris Catignani's user avatar

Chris CatignaniChris Catignani

4,75813 gold badges43 silver badges48 bronze badges

When you add subfolders and files in subfolders the DLL files in Bin folder also may have changed. When I uploaded the updated DLL file in Bin folder it solved the issue. Thanks to Mayank Modi who suggested that or hinted that.

answered Jul 31, 2019 at 5:32

Sam Patirage's user avatar

Looking at the error message, part of the code of your Default.aspx is :

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AmeriaTestTask.Default" %>

but AmeriaTestTask.Default does not exists, so you have to change it, most probably to the class defined in Default.aspx.cs. For example for web api aplications, the class defined in Global.asax.cs is : public class WebApiApplication : System.Web.HttpApplication and in the asax page you have :

<%@ Application Codebehind="Global.asax.cs" Inherits="MyProject.WebApiApplication" Language="C#" %>

answered Mar 22, 2020 at 15:08

Mario's user avatar

MarioMario

3132 silver badges11 bronze badges

I am too late but let me explain how I solved this problem.

This problem is basically because of improper folders/solution structure.

this issue may occur because
1. If you have copied project from other location and trying to run the project.

so to resolve this go to original location and crosscheck the folders and files again.

this works for me.

answered Sep 21, 2015 at 6:14

Shriganesh Kolhe's user avatar

After a lot of searching ,i found the problem was in my project dll file .i cleaned and rebuild my project when there were compilation errors …
simple solution is to remove all compilation errors in all pages either by removing contents or commenting lines ,then clean and rebuild your project …
this will sort out your problem ..

answered May 19, 2020 at 18:20

abhishek bhardwaj's user avatar

This happens when the files inside the Debug and Release folder are not created properly(Either they are having wrong reference or having overwritten many times). I have faced the same problem in which, i everything works fine when we build the solution, but when i publish the website it gives me same error.
I have solved this in following manner:

  1. Go to your Solution Explorer in Visual Studio and click on show hidden files (if they are not showing ! )
  2. you will find a folder named obj, open it .
  3. Here there are again 2 folder named respectively as Debug and Release.
    Now, delete the content from these two folder, Make sure that you do not delete the folders Debug and Release. Only delete the files and folders inside Debug and Release folder.
  4. Now build and publish your solution and everything will work like charm.

answered Sep 20, 2015 at 11:08

Roshan Parmar's user avatar

Roshan ParmarRoshan Parmar

3,6821 gold badge11 silver badges7 bronze badges

1

I am getting the following error on one of our production servers. Not sure why it is working on the DEV server?

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type ‘TestMvcApplication.MvcApplication’.

Source Error:

Line 1: <%@ Application Codebehind=»Global.asax.cs» Inherits=»TestMvcApplication.MvcApplication» Language=»C#» %>

Source File: /global.asax Line: 1

Not sure if anybody came across this error before and how it was solved, but I have reached the end.
Any help would be appreciated.

I also need to mention that this is the published code, so all is compiled.
Can there be something wrong with my compiler settings?

p.campbell's user avatar

p.campbell

97.4k67 gold badges255 silver badges319 bronze badges

asked Oct 21, 2009 at 5:07

Riaan Engelbrecht's user avatar

4

None of the other answers worked for me. I fixed my error by changing the web project’s output path. I had had it set to bindebug but the web project doesn’t work unless the output path is set to simply «bin»

Community's user avatar

answered Oct 13, 2011 at 18:16

Brian Leeming's user avatar

Brian LeemingBrian Leeming

11.5k8 gold badges30 silver badges52 bronze badges

10

I’ve had this a couple of times. It’s especially frustrating as it’s right off the bat, and the error message holds no clue as to what might be the issue.

To fix this, right click your project title, in this case «TestMvcApplication» and click build.

This forces the code to compile before you run it. Don’t ask me why, but this has been the solution 100% of the time for me.

answered Feb 12, 2010 at 14:39

Andy Copley's user avatar

7

I have found that when you are forced to use the Configuration Manager to run under x86 or anything other than the standard project «out of the box» settings, the IDE creates a bunch of sub directories under the bin folder for the web project.

Once this starts happening, if the Cassini server is running, then the project does not serve properly.

I fixed it by going into the Web Project properties -> Build settings and changing the Output Path to be bin

Then rebuild and all works as it should.

answered Nov 14, 2011 at 23:52

DamoDBear's user avatar

DamoDBearDamoDBear

2412 silver badges2 bronze badges

4

I tried all above solutions but no luck. Adding line <add assembly="*" /> to web.config fixed it for me. (You can also add to machine.config or root web.config file of the appropriate .NET framework version, I didn’t try it) Thanks to MS Support for solution.

answered Jun 13, 2011 at 18:27

Manish Jain's user avatar

Manish JainManish Jain

9,4695 gold badges39 silver badges44 bronze badges

2

After a long hard look I came accross the real issue here.

The assemblies were corrupted by the FTP client I used to upload the files to a hosted environmet.

I changed my FTP client and all is working as intended.

answered Oct 21, 2009 at 18:31

Riaan Engelbrecht's user avatar

0

I had the same problem: mine was because the web project had a platform target of x86. I was running on a 64-bit machine; other projects in the solution were set to 64-bit.

To check your settings, right click the project and choose Properties. On the Build tab, check the value of «Platform Target».

Also check your solution’s build configuration (Build menu > Configuration Manager) to check all your projects are being built to the same platform.

In both cases, make sure you check the settings both for debug and release mode — otherwise you’ll get it working on your machine but not when you deploy it!

answered Jan 13, 2011 at 10:47

teedyay's user avatar

teedyayteedyay

23.1k19 gold badges65 silver badges73 bronze badges

1

I had what looked like the same error. I tried many suggestions from many pages only to find out the problem was that I had the website set to the wrong version of .Net

No matter how many re-compiles or people saying ‘configuration problem’, nobody made the point that the .net version needed to be checked.

answered Aug 9, 2011 at 16:27

Carl Wright's user avatar

IT happens with me when I rename my project/solution.
Go to the folder of project in windows explorer (get out of VS).
Find and open the file Global (maybe you’ll find 2 files, open that dont have «.asax.cs» extension), and edit the line of error with correct path.
Good luck!

answered Nov 18, 2011 at 21:02

Paulo's user avatar

PauloPaulo

811 silver badge1 bronze badge

1

I experienced the exact same problem a couple of days ago — as far as I can tell it was an issue with a 64-bit IIS running a 32-bit web application. We changed our production server to 32-bit and this issue disappeared.

answered Dec 3, 2009 at 14:05

Jaco Pretorius's user avatar

Jaco PretoriusJaco Pretorius

24.7k11 gold badges60 silver badges93 bronze badges

Make sure your default namespace in the web project properties is the same as the namespace in the Global.asax.cs. I had modified the default namespace to make it a subnamespace, changing it back fixed this issue for me.

answered Apr 16, 2014 at 16:05

Ace Hyzer's user avatar

Ace HyzerAce Hyzer

3453 silver badges10 bronze badges

0

For completness sake I included what my issue was and how I solved it:

If your like me and have httphandlers via web.config and you have redirects from your global.asax.cs (maybe in Session_Start() ) like in my case you get this error if your startup project does not have a reference defined which points to the target where your httphandler is pointing!! (but you wont get build errors, just runtime errors)

So:

  1. Double check your web.config for any external items
  2. Double check your startup project has all the references it needs.

Cheers.

answered Apr 11, 2013 at 20:24

Chris's user avatar

ChrisChris

1,00015 silver badges25 bronze badges

1

The only time I have experienced this was when the MVC framework was not installed on the server. Could that be the case?

A missing Pages section in ViewsWeb.config could also be at fault.

Undo's user avatar

Undo

25.4k37 gold badges109 silver badges128 bronze badges

answered Oct 21, 2009 at 5:09

Daniel Elliott's user avatar

Daniel ElliottDaniel Elliott

22.5k10 gold badges63 silver badges82 bronze badges

2

I had the same error and none of your solutions helped. I think my problem was simply the name that I had chosen for the project. I had named my project ‘interface’ which when I got the parse error it said that it couldn’t load:

Line 1: <%@ Application Codebehind=»Global.asax.cs» Inherits=»@interface.MvcApplication» Language=»C#» %>

Where there was an ‘@’ sign for some reason. I am guessing the word ‘interface’ is reserved for something else and it added the @ symbol but that obviously broke something. I deleted the project and made a new one with a different name with no problems.

agf's user avatar

agf

167k42 gold badges282 silver badges234 bronze badges

answered Aug 12, 2011 at 16:26

Matt's user avatar

Here’s another one:

  1. I had been working on a web api project that was using localhost:12345.
  2. I checked out a different branch from source control containing the same project.
  3. I ran the project on the branch and got the error.
  4. I went to «Properties > Web > Project Url» and clicked «Create Virtual Directory»
  5. A dialog came up telling me that the url was mapped to a different directory (the directory for the original project).
  6. I clicked Okay and the virtual directory was remapped.
  7. The error went away.

I hope that helps someone somewhere

answered Mar 4, 2014 at 19:13

grahamesd's user avatar

grahamesdgrahamesd

4,6731 gold badge26 silver badges27 bronze badges

1

I had a lot of problems and errors to solve, some of the above answers helped, but what the final trick that made it work for me was: Go to your project, click properties.

Go to the Package/Publish Web tab and make sure the configuration is set to Release and Platform to All Platforms.

Last make sure that the «Items to deploy (applies to all deployment methods)» is set to «All files in this project folder»

It then worked fine for me.

answered Jul 13, 2011 at 14:20

Emiel Haeghebaert's user avatar

This issue is complicated because it’s easy to confuse the root cause with whatever the immediate cause happens to be.

In my case, the immediate cause was that the solution is configured to use NuGet Package Restore, but the server was not connected to the internet, so NuGet was unable to download the dependencies when building for the first time.

I believe the root cause is simply that the solution is unable to resolve dependencies correctly. It may be an incorrect path configuration, or the wrong version of an assembly, or conflicting assemblies, or a partial deployment. But in all cases, the error is simply saying that it can’t find the type specified in global.asax because it can’t build it.

answered Mar 4, 2013 at 19:47

shovavnik's user avatar

shovavnikshovavnik

2,8683 gold badges24 silver badges21 bronze badges

Make sure that the Namespace in the Global.asax file matches that in the Global.cs file i.e.

Global.asax: Some.Website.Webapplication

Global.cs: Some.Website (minus the ‘WebApplication’)

Jay Walker's user avatar

Jay Walker

4,6355 gold badges46 silver badges53 bronze badges

answered Aug 8, 2013 at 20:16

TheDaveJay's user avatar

TheDaveJayTheDaveJay

7436 silver badges11 bronze badges

I tried most of the above answers and they didn’t work. For some reason just closing and reopening VS fixed the problem for me.

answered Feb 4, 2016 at 20:43

Rochelle C's user avatar

Rochelle CRochelle C

8983 gold badges10 silver badges22 bronze badges

My issue was solved when I converted in IIS the physical folder that was containing the files to an application. Right click > convert to application.

mortb's user avatar

mortb

9,0413 gold badges25 silver badges42 bronze badges

answered Dec 10, 2014 at 20:55

jayt.dev's user avatar

jayt.devjayt.dev

9696 gold badges14 silver badges36 bronze badges

For me, it was because I had temporarily excluded the file from the project. I merely included it in back in the project and then it worked.

answered Jun 20, 2013 at 14:11

mstechnewbie's user avatar

1

In my case reference of System.Web.MVC was missing from my project. But after adding references issue was same so i checked properties of my Bin folder it was ReadOnly. Just after making it writable,everything working fine.

answered Nov 20, 2013 at 10:42

yashpal's user avatar

yashpalyashpal

3261 gold badge3 silver badges16 bronze badges

I was getting error because I deployed the application as a virtual directory and I was was getting parser error «could not load type» then I deployed the application as a web site and i was not getting that error again.

answered Mar 5, 2014 at 22:08

Riaz's user avatar

None of the other answers resolved this error for me.
I did find a solution that worked, which I suggest for those in the same situation:

  1. Close Visual Studio
  2. Browse to ProjectsyourProjectyourProject
  3. Rename Web.Debug.config and Web.Release.config
  4. Rebuild and run your application

ahsteele's user avatar

ahsteele

26k27 gold badges137 silver badges247 bronze badges

answered Jun 20, 2011 at 16:42

Charles Burns's user avatar

Charles BurnsCharles Burns

10.2k7 gold badges66 silver badges81 bronze badges

1

I never really did get to the bottom of what was causing it for me. I think somewhere I must have been missing some files. I got the error after publishing to a new server. Eventually I copied the site from working site. Then the site worked and so did further publishes to the new server.

answered Oct 14, 2011 at 14:57

Giles Roberts's user avatar

Giles RobertsGiles Roberts

6,2586 gold badges47 silver badges63 bronze badges

Follow these steps:

  1. Build
  2. Configuration Manager
  3. Put the AnyCPU project
  4. Back to generate
  5. Ready, after this just follow the same steps to pass it to x86 or x64

Jesse's user avatar

Jesse

8,4957 gold badges46 silver badges57 bronze badges

answered Apr 10, 2013 at 20:56

Ragdare's user avatar

For me, I had a DLL included with my project that had to be run in a 32-bit environment.

The server was configured to run the website in 32-bit mode, but I was not able to run the application on my 64-bit machine because the localhost folder had not been specified to run in 32-bit mode.

answered May 24, 2013 at 18:47

jp2code's user avatar

jp2codejp2code

26.2k40 gold badges154 silver badges268 bronze badges

I just had a similar problem.

The reason was that I was changing a file.aspx.c and had to do a clean rebuild. After that everything worked.

answered Oct 10, 2013 at 11:13

Fannar Örn Hermannsson's user avatar

My problem was that I was trying to create a ASPX web application in a subfolder of a folder that already had a web.config file, and

So I opened up the parent folder in Visual Studio as a Web Site (Open > Web Site) I was able to add a new item ASPX page that had no issue parsing/loading.

answered Dec 5, 2013 at 19:55

jamespgilbert's user avatar

For me, the problem was only on certain (long) links within the website and was tracked down to URLScan having the default configuration of a URL length limit of 260.

answered Dec 17, 2013 at 23:58

James's user avatar

JamesJames

613 bronze badges

I’ve had the same issue.
Try to:

Right click on the project and select Clean, then right click on it again and select Rebuild and run the project to see if it worked.

answered Jan 2, 2014 at 12:54

da Rocha Pires's user avatar

da Rocha Piresda Rocha Pires

2,4241 gold badge24 silver badges19 bronze badges

I am getting the following error on one of our production servers. Not sure why it is working on the DEV server?

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type ‘TestMvcApplication.MvcApplication’.

Source Error:

Line 1: <%@ Application Codebehind=»Global.asax.cs» Inherits=»TestMvcApplication.MvcApplication» Language=»C#» %>

Source File: /global.asax Line: 1

Not sure if anybody came across this error before and how it was solved, but I have reached the end.
Any help would be appreciated.

I also need to mention that this is the published code, so all is compiled.
Can there be something wrong with my compiler settings?

p.campbell's user avatar

p.campbell

97.4k67 gold badges255 silver badges319 bronze badges

asked Oct 21, 2009 at 5:07

Riaan Engelbrecht's user avatar

4

None of the other answers worked for me. I fixed my error by changing the web project’s output path. I had had it set to bindebug but the web project doesn’t work unless the output path is set to simply «bin»

Community's user avatar

answered Oct 13, 2011 at 18:16

Brian Leeming's user avatar

Brian LeemingBrian Leeming

11.5k8 gold badges30 silver badges52 bronze badges

10

I’ve had this a couple of times. It’s especially frustrating as it’s right off the bat, and the error message holds no clue as to what might be the issue.

To fix this, right click your project title, in this case «TestMvcApplication» and click build.

This forces the code to compile before you run it. Don’t ask me why, but this has been the solution 100% of the time for me.

answered Feb 12, 2010 at 14:39

Andy Copley's user avatar

7

I have found that when you are forced to use the Configuration Manager to run under x86 or anything other than the standard project «out of the box» settings, the IDE creates a bunch of sub directories under the bin folder for the web project.

Once this starts happening, if the Cassini server is running, then the project does not serve properly.

I fixed it by going into the Web Project properties -> Build settings and changing the Output Path to be bin

Then rebuild and all works as it should.

answered Nov 14, 2011 at 23:52

DamoDBear's user avatar

DamoDBearDamoDBear

2412 silver badges2 bronze badges

4

I tried all above solutions but no luck. Adding line <add assembly="*" /> to web.config fixed it for me. (You can also add to machine.config or root web.config file of the appropriate .NET framework version, I didn’t try it) Thanks to MS Support for solution.

answered Jun 13, 2011 at 18:27

Manish Jain's user avatar

Manish JainManish Jain

9,4695 gold badges39 silver badges44 bronze badges

2

After a long hard look I came accross the real issue here.

The assemblies were corrupted by the FTP client I used to upload the files to a hosted environmet.

I changed my FTP client and all is working as intended.

answered Oct 21, 2009 at 18:31

Riaan Engelbrecht's user avatar

0

I had the same problem: mine was because the web project had a platform target of x86. I was running on a 64-bit machine; other projects in the solution were set to 64-bit.

To check your settings, right click the project and choose Properties. On the Build tab, check the value of «Platform Target».

Also check your solution’s build configuration (Build menu > Configuration Manager) to check all your projects are being built to the same platform.

In both cases, make sure you check the settings both for debug and release mode — otherwise you’ll get it working on your machine but not when you deploy it!

answered Jan 13, 2011 at 10:47

teedyay's user avatar

teedyayteedyay

23.1k19 gold badges65 silver badges73 bronze badges

1

I had what looked like the same error. I tried many suggestions from many pages only to find out the problem was that I had the website set to the wrong version of .Net

No matter how many re-compiles or people saying ‘configuration problem’, nobody made the point that the .net version needed to be checked.

answered Aug 9, 2011 at 16:27

Carl Wright's user avatar

IT happens with me when I rename my project/solution.
Go to the folder of project in windows explorer (get out of VS).
Find and open the file Global (maybe you’ll find 2 files, open that dont have «.asax.cs» extension), and edit the line of error with correct path.
Good luck!

answered Nov 18, 2011 at 21:02

Paulo's user avatar

PauloPaulo

811 silver badge1 bronze badge

1

I experienced the exact same problem a couple of days ago — as far as I can tell it was an issue with a 64-bit IIS running a 32-bit web application. We changed our production server to 32-bit and this issue disappeared.

answered Dec 3, 2009 at 14:05

Jaco Pretorius's user avatar

Jaco PretoriusJaco Pretorius

24.7k11 gold badges60 silver badges93 bronze badges

Make sure your default namespace in the web project properties is the same as the namespace in the Global.asax.cs. I had modified the default namespace to make it a subnamespace, changing it back fixed this issue for me.

answered Apr 16, 2014 at 16:05

Ace Hyzer's user avatar

Ace HyzerAce Hyzer

3453 silver badges10 bronze badges

0

For completness sake I included what my issue was and how I solved it:

If your like me and have httphandlers via web.config and you have redirects from your global.asax.cs (maybe in Session_Start() ) like in my case you get this error if your startup project does not have a reference defined which points to the target where your httphandler is pointing!! (but you wont get build errors, just runtime errors)

So:

  1. Double check your web.config for any external items
  2. Double check your startup project has all the references it needs.

Cheers.

answered Apr 11, 2013 at 20:24

Chris's user avatar

ChrisChris

1,00015 silver badges25 bronze badges

1

The only time I have experienced this was when the MVC framework was not installed on the server. Could that be the case?

A missing Pages section in ViewsWeb.config could also be at fault.

Undo's user avatar

Undo

25.4k37 gold badges109 silver badges128 bronze badges

answered Oct 21, 2009 at 5:09

Daniel Elliott's user avatar

Daniel ElliottDaniel Elliott

22.5k10 gold badges63 silver badges82 bronze badges

2

I had the same error and none of your solutions helped. I think my problem was simply the name that I had chosen for the project. I had named my project ‘interface’ which when I got the parse error it said that it couldn’t load:

Line 1: <%@ Application Codebehind=»Global.asax.cs» Inherits=»@interface.MvcApplication» Language=»C#» %>

Where there was an ‘@’ sign for some reason. I am guessing the word ‘interface’ is reserved for something else and it added the @ symbol but that obviously broke something. I deleted the project and made a new one with a different name with no problems.

agf's user avatar

agf

167k42 gold badges282 silver badges234 bronze badges

answered Aug 12, 2011 at 16:26

Matt's user avatar

Here’s another one:

  1. I had been working on a web api project that was using localhost:12345.
  2. I checked out a different branch from source control containing the same project.
  3. I ran the project on the branch and got the error.
  4. I went to «Properties > Web > Project Url» and clicked «Create Virtual Directory»
  5. A dialog came up telling me that the url was mapped to a different directory (the directory for the original project).
  6. I clicked Okay and the virtual directory was remapped.
  7. The error went away.

I hope that helps someone somewhere

answered Mar 4, 2014 at 19:13

grahamesd's user avatar

grahamesdgrahamesd

4,6731 gold badge26 silver badges27 bronze badges

1

I had a lot of problems and errors to solve, some of the above answers helped, but what the final trick that made it work for me was: Go to your project, click properties.

Go to the Package/Publish Web tab and make sure the configuration is set to Release and Platform to All Platforms.

Last make sure that the «Items to deploy (applies to all deployment methods)» is set to «All files in this project folder»

It then worked fine for me.

answered Jul 13, 2011 at 14:20

Emiel Haeghebaert's user avatar

This issue is complicated because it’s easy to confuse the root cause with whatever the immediate cause happens to be.

In my case, the immediate cause was that the solution is configured to use NuGet Package Restore, but the server was not connected to the internet, so NuGet was unable to download the dependencies when building for the first time.

I believe the root cause is simply that the solution is unable to resolve dependencies correctly. It may be an incorrect path configuration, or the wrong version of an assembly, or conflicting assemblies, or a partial deployment. But in all cases, the error is simply saying that it can’t find the type specified in global.asax because it can’t build it.

answered Mar 4, 2013 at 19:47

shovavnik's user avatar

shovavnikshovavnik

2,8683 gold badges24 silver badges21 bronze badges

Make sure that the Namespace in the Global.asax file matches that in the Global.cs file i.e.

Global.asax: Some.Website.Webapplication

Global.cs: Some.Website (minus the ‘WebApplication’)

Jay Walker's user avatar

Jay Walker

4,6355 gold badges46 silver badges53 bronze badges

answered Aug 8, 2013 at 20:16

TheDaveJay's user avatar

TheDaveJayTheDaveJay

7436 silver badges11 bronze badges

I tried most of the above answers and they didn’t work. For some reason just closing and reopening VS fixed the problem for me.

answered Feb 4, 2016 at 20:43

Rochelle C's user avatar

Rochelle CRochelle C

8983 gold badges10 silver badges22 bronze badges

My issue was solved when I converted in IIS the physical folder that was containing the files to an application. Right click > convert to application.

mortb's user avatar

mortb

9,0413 gold badges25 silver badges42 bronze badges

answered Dec 10, 2014 at 20:55

jayt.dev's user avatar

jayt.devjayt.dev

9696 gold badges14 silver badges36 bronze badges

For me, it was because I had temporarily excluded the file from the project. I merely included it in back in the project and then it worked.

answered Jun 20, 2013 at 14:11

mstechnewbie's user avatar

1

In my case reference of System.Web.MVC was missing from my project. But after adding references issue was same so i checked properties of my Bin folder it was ReadOnly. Just after making it writable,everything working fine.

answered Nov 20, 2013 at 10:42

yashpal's user avatar

yashpalyashpal

3261 gold badge3 silver badges16 bronze badges

I was getting error because I deployed the application as a virtual directory and I was was getting parser error «could not load type» then I deployed the application as a web site and i was not getting that error again.

answered Mar 5, 2014 at 22:08

Riaz's user avatar

None of the other answers resolved this error for me.
I did find a solution that worked, which I suggest for those in the same situation:

  1. Close Visual Studio
  2. Browse to ProjectsyourProjectyourProject
  3. Rename Web.Debug.config and Web.Release.config
  4. Rebuild and run your application

ahsteele's user avatar

ahsteele

26k27 gold badges137 silver badges247 bronze badges

answered Jun 20, 2011 at 16:42

Charles Burns's user avatar

Charles BurnsCharles Burns

10.2k7 gold badges66 silver badges81 bronze badges

1

I never really did get to the bottom of what was causing it for me. I think somewhere I must have been missing some files. I got the error after publishing to a new server. Eventually I copied the site from working site. Then the site worked and so did further publishes to the new server.

answered Oct 14, 2011 at 14:57

Giles Roberts's user avatar

Giles RobertsGiles Roberts

6,2586 gold badges47 silver badges63 bronze badges

Follow these steps:

  1. Build
  2. Configuration Manager
  3. Put the AnyCPU project
  4. Back to generate
  5. Ready, after this just follow the same steps to pass it to x86 or x64

Jesse's user avatar

Jesse

8,4957 gold badges46 silver badges57 bronze badges

answered Apr 10, 2013 at 20:56

Ragdare's user avatar

For me, I had a DLL included with my project that had to be run in a 32-bit environment.

The server was configured to run the website in 32-bit mode, but I was not able to run the application on my 64-bit machine because the localhost folder had not been specified to run in 32-bit mode.

answered May 24, 2013 at 18:47

jp2code's user avatar

jp2codejp2code

26.2k40 gold badges154 silver badges268 bronze badges

I just had a similar problem.

The reason was that I was changing a file.aspx.c and had to do a clean rebuild. After that everything worked.

answered Oct 10, 2013 at 11:13

Fannar Örn Hermannsson's user avatar

My problem was that I was trying to create a ASPX web application in a subfolder of a folder that already had a web.config file, and

So I opened up the parent folder in Visual Studio as a Web Site (Open > Web Site) I was able to add a new item ASPX page that had no issue parsing/loading.

answered Dec 5, 2013 at 19:55

jamespgilbert's user avatar

For me, the problem was only on certain (long) links within the website and was tracked down to URLScan having the default configuration of a URL length limit of 260.

answered Dec 17, 2013 at 23:58

James's user avatar

JamesJames

613 bronze badges

I’ve had the same issue.
Try to:

Right click on the project and select Clean, then right click on it again and select Rebuild and run the project to see if it worked.

answered Jan 2, 2014 at 12:54

da Rocha Pires's user avatar

da Rocha Piresda Rocha Pires

2,4241 gold badge24 silver badges19 bronze badges

Я закончил простой проект веб-приложения asp.net, скомпилировал его и попытался протестировать на локальном IIS. Я создал виртуальный каталог, сопоставил его с физическим каталогом, затем поместил туда все необходимые файлы, включая папку bin со всеми .dll. В настройках проекта, раздел сборки, выходной путь — bin Итак, когда я пытаюсь просмотреть свое приложение, я получил :

Server Error in '/' Application.
--------------------------------------------------------------------------------

Parser Error 
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Could not load type 'AmeriaTestTask.Default'.

Source Error: 


Line 1:  <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AmeriaTestTask.Default" %>
Line 2:  
Line 3:  <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>


Source File: /virtual/default.aspx    Line: 1 

Введите описание изображения здесь

Прочитал похожие сообщения о проблемах, и решение состояло в том, чтобы установить выходной путь в bin, но это по умолчанию для моего проекта.

17 ответы

Я знаю, что слишком поздно, чтобы ответить, но это может помочь другим и сэкономить время.

Ниже могут быть другие решения.

Solution 1: Подробные инструкции по созданию виртуального каталога для вашего приложения см. в разделе Создание виртуального каталога для вашего приложения.

Solution 2: Папка Bin вашего приложения отсутствует или отсутствует DLL-файл приложения. Подробные инструкции см. в разделе Копирование файлов приложения на рабочий сервер.

Solution 3: Возможно, вы выполнили развертывание в корневой веб-папке, но не изменили некоторые параметры в файле Web.config. Подробные инструкции см. в разделе Развертывание в корневом каталоге.

В моем случае Solution 2 работает, при развертывании на сервере некоторых DLL's от bin каталог не был успешно загружен на сервер. У меня есть заново закачать все DLL и это работает !!

Вот реферальная ссылка на решить ошибку парсера asp.net.

Создан 18 сен.

Я была такая же проблема. Провел 5 или 6 часов исследований. Кажется, простое решение работает. Мне просто нужно было преобразовать мою папку в приложение из iis. Это работало нормально. (это был сценарий, когда я выполнил миграцию с сервера 2003 на сервер 2008 R2)

(1) Откройте IIS и выберите веб-сайт и соответствующую папку, которую необходимо преобразовать. Щелкните правой кнопкой мыши и выберите «Преобразовать в приложение».

Введите описание изображения здесь

ответ дан 20 авг.

Попробуйте изменить CodeBehind="Default.aspx.cs" в CodeFile="Default.aspx.cs"

Создан 16 июн.

Иногда это происходит, если вы либо:

  1. Чистое решение/сборка или,
  2. Перестроить решение/сборка.

Если это «внезапно» произойдет после этого, и ваш код строить-time, попробуйте сначала исправить эти ошибки.

Что происходит, так это то, что по мере создания вашего решения файлы DLL создаются и сохраняются в папке bin проектов. Если во время сборки в вашем коде возникает ошибка, файлы DLL создаются неправильно, что приводит к ошибке.

«Быстрое исправление» будет заключаться в том, чтобы исправить все ваши ошибки или закомментировать их (если они не повлияют на другие веб-страницы), а затем перестроить проект/решение.

Если это не работает, попробуйте изменить:
CodeBehind=»blahblahblah.aspx.cs»

чтобы:
CodeFile=»blahblahblah.aspx.cs»

Примечание. Измените «blahblahblah» на настоящее имя страницы.

Создан 23 фев.

Создан 10 фев.

Я решил это так.

Перейдите к файлу проекта, скажем, project/name/bin и удалите все в папке bin. (это даст вам еще одну ошибку, которую вы можете решить таким образом)

затем в вашей визуальной студии щелкните правой кнопкой мыши папку проекта «Ссылки», чтобы открыть диспетчер пакетов NuGet.

Перейдите к просмотру и установке «DotNetCompilerPlatform».

Создан 19 сен.

Столкнулся с той же ошибкой, когда у меня была ошибка программирования в одном из файлов ASHX: он был создан путем копирования другого файла и унаследовал имя своего класса в операторе кода позади. Не было ошибки, когда все файлы ASPX и ASHX запускались в IIS Express локально, но после развертывания на сервере они перестали работать (все).

Как только я нашел эту страницу ASHX и исправил имя класса, чтобы оно отражало его собственное имя класса, все файлы ASPX и ASHX начали нормально работать в IIS.

ответ дан 05 окт ’16, 17:10

Здесь очень старый вопрос, но я столкнулся с той же ошибкой, и ни один из предоставленных ответов не решил проблему.

Моя проблема возникла из-за того, что я вручную изменил пространство имен и имена сборок проекта после первоначального создания. Мне потребовалось немного времени, чтобы заметить, что пространство имен в Inherits атрибут не соответствует обновленному пространству имен.

Обновление этого пространства имен в разметке Global.asax для соответствия пространству имен приложений исправило ошибку для меня.

ответ дан 16 окт ’19, 21:10

Версия IIS 7 или IIS 8 или 8.5 — если вы переходите с 2003 на 2012/2008, убедитесь, что веб-служба относится к типу приложения, а не к виртуальному каталогу.

Создан 31 июля ’15, 10:07

В моем случае была новая ветвь кода, а старая ветвь кода была развернута локально в IIS. Таким образом, он указывал на старый код ветки, который был недоступен. Итак, я развернул свой код в IIS с новой веткой, и теперь он работает.

ответ дан 27 дек ’17, 14:12

В моем случае я пропустил тег компиляции в файле .csproj.

<Compile Include="Global.asax.cs">
  <DependentUpon>Global.asax</DependentUpon>
  <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>

ответ дан 30 апр.

Интересны разные сценарии..

В моем случае… я загрузил свой сайт в GoDaddy и получил ошибку парсера.

Я решил это, закомментировав compilers под system.codedom в веб.конфигурации. А также добавить настраиваемый профиль для публикации, который бы прекомпилировался во время публикации.

  <system.codedom>
    <!--GoDaddy does not compile!-->
    <!--<compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=&quot;Web&quot; /optionInfer+" />
    </compilers>-->
  </system.codedom>

ответ дан 05 апр.

Когда вы добавляете вложенные папки и файлы в подпапки, файлы DLL в папке Bin также могут измениться. Когда я загрузил обновленный файл DLL в папку Bin, проблема решилась. Спасибо Mayank Modi, который предложил это или намекнул на это.

Создан 31 июля ’19, 06:07

Глядя на сообщение об ошибке, часть кода вашего Default.aspx является :

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AmeriaTestTask.Default" %>

но AmeriaTestTask.Default не существует, поэтому его необходимо изменить, скорее всего, на класс, определенный в Default.aspx.cs. Например, для приложений веб-API класс, определенный в Global.asax.cs: public class WebApiApplication : System.Web.HttpApplication и на странице asax у вас есть:

<%@ Application Codebehind="Global.asax.cs" Inherits="MyProject.WebApiApplication" Language="C#" %>

ответ дан 22 мар ’20, в 15:03

Я слишком поздно, но позвольте мне объяснить, как я решил эту проблему.

Эта проблема в основном из-за неправильной структуры папок/решений.

эта проблема может возникнуть из-за того, что 1. Если вы скопировали проект из другого места и пытаетесь запустить проект.

поэтому, чтобы решить эту проблему, перейдите в исходное местоположение и снова проверьте папки и файлы.

это работает для меня.

Создан 21 сен.

После долгих поисков,я обнаружил, что проблема была в файле dll моего проекта. Я очистил и перестроил свой проект, когда были ошибки компиляции …
Простое решение состоит в том, чтобы удалить все ошибки компиляции на всех страницах, либо удалив содержимое, либо строки комментариев, затем очистив и перестроив проект… это решит вашу проблему..

ответ дан 19 мая ’20, 19:05

Это происходит, когда файлы в папке «Отладка и выпуск» не созданы должным образом (либо они имеют неправильную ссылку, либо перезаписываются много раз). Я столкнулся с той же проблемой, когда все работает нормально, когда мы создаем решение, но когда я публикую веб-сайт, он дает мне ту же ошибку. Я решил это следующим образом:

  1. Перейдите в обозреватель решений в Visual Studio и нажмите «Показать скрытые файлы» (если они не отображаются!)
  2. вы найдете папку с именем obj, откройте ее.
  3. Здесь снова есть 2 папки с именами соответственно Debug и Release. Теперь удалите содержимое из этих двух папок. Убедитесь, что вы не удалили папки Debug и Release. Удаляйте только файлы и папки внутри папки Debug and Release.
  4. Теперь создайте и опубликуйте свое решение, и все будет работать как часы.

Создан 20 сен.

Не тот ответ, который вы ищете? Просмотрите другие вопросы с метками

asp.net
parsing
deployment

or задайте свой вопрос.

Hey I am getting the following error

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type ‘_AddToCart’.

Source Error:

Line 1:  <%@ Page Language="C#" AutoEventWireup="true" Codebehind="AddToCart.aspx.cs" Inherits="_AddToCart" Title="Untitled Page" %>
Line 2:  
Line 3:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


Source File: /FSAICart/AddToCart.aspx    Line: 1 

Where I do have the matching code behind file which is defined as follows

    using System;
  public partial class _AddToCart : System.Web.UI.Page {

Any Ideas ?

Muhammad Akhtar's user avatar

asked Jun 2, 2011 at 10:25

StevieB's user avatar

3

Try changing CodeBehind:

<%@ Page Language="C#"
AutoEventWireup="true"
**Codebehind**="AddToCart.aspx.cs"
Inherits="_AddToCart" Title="Untitled
Page" %>

To CodeFile:

<%@ Page Language="C#"
AutoEventWireup="true"
**CodeFile**="AddToCart.aspx.cs"
Inherits="_AddToCart" Title="Untitled
Page" %>

ASP .NET 1.1 used CodeBehind for compiling code in a separate file. ASP .NET 2.0 introduced the CodeFile syntax for compilation of partial classes.

See here for a more detailed explanation.

Lingnik's user avatar

answered Jun 2, 2011 at 13:25

Phaedrus's user avatar

PhaedrusPhaedrus

8,31126 silver badges28 bronze badges

0

Specify the namespace of the Inherits property of Page directive

Look at codebehind of your page. It looks like:

namespace MyWebSite
{
     public partial class _AddToCart : System.Web.UI.Page 
     {
        //...
     }           
}

So you must change Page directive to:

<%@ Page Language="C#" AutoEventWireup="true" Codebehind="AddToCart.aspx.cs" Inherits="MyWebSite._AddToCart" Title="Untitled Page" %>

Drew Gaynor's user avatar

Drew Gaynor

8,1465 gold badges39 silver badges52 bronze badges

answered Jun 2, 2011 at 10:29

Yuriy Rozhovetskiy's user avatar

1


Форум программистов Vingrad

> Ошибка синтаксического анализатора (веб-служба) 

V

Опции темы

akizelokro

Крокодил
**

Профиль
Группа: Участник
Сообщений: 761
Регистрация: 30.7.2007

Репутация: нет
Всего: 5

Написал веб-службу. В Visual Studio работает. Поставил IIS, создал виртуальный каталог, закопировал туда «всё», получаю комментарий:

Цитата
Ошибка синтаксического анализатора 
Описание: Ошибка при разборе ресурса, требуемого для обслуживания этого запроса. Изучите следующие подробные сведения о данной ошибке разбора и измените исходный файл. 

Сообщение об ошибке синтаксического анализатора: Не удалось создать тип ‘WebServiceAgent.Service1’.

Ошибка источника: 

Строка 1:  <%@ WebService Language=»C#» CodeBehind=»Service1.asmx.cs» Class=»WebServiceAgent.Service1″ %>

 Исходный файл: /servi/Service1.asmx    Строка: 1 

Вроде все сделал, как требовалось. aspnet_regiis -i прописал. Виртуальный каталог — опции по умолчанию. 

Это сообщение отредактировал(а) akizelokro — 4.8.2008, 12:16

———————

a = a + b; b = a — b; a = a — b;

mr.DUDA

3D-маньяк
****

Профиль
Группа: Экс. модератор
Сообщений: 8244
Регистрация: 27.7.2003
Где: город-герой Минск

Репутация: 5
Всего: 232

Длл-ку скопировали в bin? Класс WebServiceAgent.Service1 там есть и так и называется?

———————

user posted image

akizelokro

Крокодил
**

Профиль
Группа: Участник
Сообщений: 761
Регистрация: 30.7.2007

Репутация: нет
Всего: 5

Где bin надо делать? В виртуальном каталоге?

Понял. Это что, получается, мне в IIS обязательно каталог bin создавать?

Это сообщение отредактировал(а) akizelokro — 5.8.2008, 12:19

———————

a = a + b; b = a — b; a = a — b;

Kosten

Новичок

Профиль
Группа: Участник
Сообщений: 45
Регистрация: 30.6.2003
Где: Cанкт-Петербург

Репутация: нет
Всего: нет

akizelokro, а ты ручками копировал на IIS?

Idsa

Эксперт
****

Профиль
Группа: Участник
Сообщений: 2086
Регистрация: 5.12.2006
Где: Томск

Репутация: 15
Всего: 62

Цитата(akizelokro @  5.8.2008,  15:09 Найти цитируемый пост)
Это что, получается, мне в IIS обязательно каталог bin создавать?

Все, что нужно, — положить в виртуальный каталог сборку из каталога bin.

———————

Мой блог: alexidsa.blogspot.com

mr.DUDA

3D-маньяк
****

Профиль
Группа: Экс. модератор
Сообщений: 8244
Регистрация: 27.7.2003
Где: город-герой Минск

Репутация: 5
Всего: 232

Цитата(akizelokro @  5.8.2008,  11:09 Найти цитируемый пост)
Понял. Это что, получается, мне в IIS обязательно каталог bin создавать?

В виртуальной директории лежит .asmx файл, а во вложенной директории bin будет dll-ка. Если просто .asmx скопировать — никакого веб-сервиса из воздуха не материализуется.  smile 

———————

user posted image

v_enom

Шустрый
*

Профиль
Группа: Участник
Сообщений: 101
Регистрация: 11.10.2006

Репутация: нет
Всего: нет

народ, помогите, такая же трабла, но я все перенес в каталог.

каталог находится по адресу:

C:CodeTestHelloWS

в нем лежат      ….bin  WebService1.dll    и  WebService1.pdb
                              Service1.asmx
                              Service1.asmx.cs

есди запускать код из файла Service1.asmx, то все работает, а если с кодбехайнд и прикрепить Service1.asmx.cs то выдается такая же ошибка 
(  
 Ошибка синтаксического анализатора
Описание: Ошибка при разборе ресурса, требуемого для обслуживания этого запроса. Изучите следующие подробные сведения о данной ошибке разбора и измените исходный файл.

Сообщение об ошибке синтаксического анализатора: Не удалось создать тип ‘WebService1.Service1’.

Ошибка источника:

Строка 1:  <%@ WebService Language=»C#» CodeBehind=»Service1.asmx.cs» Class=»WebService1.Service1″ %>

)

вот что у меня в файле .asmx.cs

Код

using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;

namespace WebService1
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://localhost")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    public class Service1 : System.Web.Services.WebService
    {

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }

        [WebMethod]
        public string ReversString(string MyMessage)
        {

            char[] arr = MyMessage.ToCharArray();
            Array.Reverse(arr);
            MyMessage = new string(arr);
            return MyMessage;

        }
    }
}

IIS 6.0, только поставил, особых настроек не делал. Только asp.net подключил и все….

Это сообщение отредактировал(а) v_enom — 17.9.2009, 16:04

v_enom

Шустрый
*

Профиль
Группа: Участник
Сообщений: 101
Регистрация: 11.10.2006

Репутация: нет
Всего: нет

решил эту проблему сперва развернув проект автоматически:

1. Создал простой проект web site service application 
2. Затем проект-свойства-web
3. прописал путь под галочкой use local IIS server 

Код

[URL=http://localhost:4000/WebService/WebService2]

и создал виртуальный каталог
user posted image

при этом у меня уже был зарегистрирован один веб-сервис — webService.
Т.е. когда я открыл IIS manager то увидел, что WebService2 прописан был как сервис внутри webService, а внутри него (webService2) уже был файл *.asmx
ранее я делал неправильно и внутри сервиса webService создавал папку, куда кидал *.asmx, *.asmx.cs и bin. Это не правильно, это ошибка и так не работает.

А вообще лучше переносить на IIS все автоматически. 

user posted image

при этом надо не забыть зарегистрировать asp.net в IIS через консольную команду «aspnet_regiis.exe -i»  в папке C:WINDOWSMicrosoft.NETFrameworkv2.0.50727 ,  выставить ASP.net 2.0 в свойствах сервиса,  
и еще в IIS manager в свойствах веб узла(и всех сервисов в т.ч.) Свойства-безопасность каталога-изменить надо поставить галочку «встроенная проверка подлинности Windows»

Это сообщение отредактировал(а) v_enom — 18.9.2009, 11:15



















Прежде чем создать тему, посмотрите сюда:
Любитель

Mymik

mr.DUDA

  • Что же такое .NET? Краткое описание, изучаем.
  • Какой язык программирования выбрать? выбираем.
  • C#. С чего начать? начинаем.
  • Обзор новых возможностей VS 2005, интересуемся.
  • Защита исходного кода .NET приложений, защищаем.
  • Литература по .NET, обращаемся.
  • Вопросы по .NET можно задать также в разделах: VB.NET, Delphi.NET.

  • FAQ раздела, ищем здесь.
  • Архиполезные ссылки: www.connectionstrings.com, www.pinvoke.net, www.codeproject.com

Используйте теги [code=csharp][/code] для подсветки кода. Используйтe чекбокс «транслит» если у Вас нет русских шрифтов.


Если Вам понравилась атмосфера форума, заходите к нам чаще! С уважением, Любитель, Mymik, mr.DUDA.

0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | Разработка под ASP.NET | Следующая тема »

#asp.net

#asp.net

Вопрос:

Ошибка сервера в приложении ‘/ elogs’.

Описание ошибки синтаксического анализатора: ошибка произошла во время синтаксического анализа ресурса, необходимого для обслуживания этого запроса. Пожалуйста, ознакомьтесь со следующими конкретными сведениями об ошибках синтаксического анализа и соответствующим образом измените исходный файл.

Сообщение об ошибке синтаксического анализатора: неизвестный тег сервера ‘IND:InderGrid’.

Ошибка источника:

 Line 1:  <%@ Page Language="C#" MasterPageFile="~/eLogS_Sea/New_MasterPage.master" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="eLogS_Sea_Default2" Title="Untitled Page" %>
Line 2:  <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
Line 3:      <IND:InderGrid ID="inderGrid" runat="server" AllowPaging="true" CellPadding="4" CheckBoxColumn="true"      
Line 4:          CustomPageing="true" Font-Names="Tahoma" ForeColor="#333333" GridLines="None"
Line 5:          OnPageIndexChanging="inderGrid_PageIndexChanging" OnRowCreated="inderGrid_RowCreated"


Source File: /elogs/eLogS_Sea/Default2.aspx    Line: 3 
 

Любой, пожалуйста, немедленно помогите

Ответ №1:

Возможно, вам потребуется зарегистрировать элемент управления на странице:

 <%@ Register TagPrefix="scott" TagName="header" Src="Controls/Header.ascx" %>
<%@ Register TagPrefix="scott" TagName="footer" Src="Controls/Footer.ascx" %>
<%@ Register TagPrefix="ControlVendor" Assembly="ControlVendor" %>

<html>
  <body>
     <form id="form1" runat="server">
        <scott:header ID="MyHeader" runat="server" />
     </form>
 </body>
</html>
 

Это было взято из блога Скотта Гу

Комментарии:

1. Откуда берется InderGrid? это другой элемент управления (как в InderGrid.ascx) или он из библиотеки dll?

2. Затем в верхней части Default2.aspx в разделе <%@ Page Language=»C #» добавьте: <%@ Register TagPrefix=»scott» tagName=»нижний колонтитул» Src=»<путь>/ InderGrid.ascx» %>

3. извините, это происходит из dll name is Indrajeet.dll

4. Добавьте следующее и замените пространство имен (убедитесь, что оно включено в ссылки на проект): <%@ Register TagPrefix=»IND» Пространство имен=»Indrajeet» Сборка =»Indrajeet» %>

I Published a website using VS2012, ASP.NET C#, the publish succeeds however, when i open the .ASPX file, this shows ups:

XML Parsing Error: not well-formed

Location: file:///E:/Test/Default.aspx Line Number 1, Column 2: <%@ page language="C#" autoeventwireup="true" inherits="_Default, App_Web_bf0k3pjd" maintainScrollPositionOnPostBack="true" %> -^

1 solution

Solution 1

Hi,

This error could come when the IIS server isnt configured properly.
Hence, go to virtual directory’s Properties tab and check the version of ASP.NET that you are using.

You can also try to re-register the IIS server. For this, Open VisualStudioCommandPrompt and type

aspnet_regiis - i

and Enter.

Please reply incase this doesnt work.

Regards,
Praneet

Недавно я преобразовал проект веб-сайта в проект веб-приложения в Visual Studio 2008. Я, наконец, получил его для компиляции, и первая страница (экран входа) отображается как обычно, но затем, когда она перенаправляется на страницу Default.aspx, Я получил сообщение об ошибке:

Parser Error Message: 'SOME.NAMESPACE.MyApplicationName.WebApplication._Default' is not allowed here because it does not extend class 'System.Web.UI.Page'.

Все мои страницы наследуются от класса под названием «BasePage», который расширяет System.Web.UI.Page. Очевидно, проблема не в этом классе, потому что страница login.aspx отображается без ошибок, и она также наследуется от этой базовой страницы.

Все страницы сайта, включая страницу входа, являются дочерними страницами главной страницы.

После некоторого тестирования я определил, что именно вызывает ошибку (хотя я не знаю, ПОЧЕМУ он это делает).

На всех страницах, где у меня есть следующий тег, ошибка не возникает.

<%@ MasterType VirtualPath="~/MasterPages/MainMaster.master" %>

На всех страницах, которые не содержат эту строку, возникает ошибка. Это на протяжении всего приложения. У меня есть тег только на страницах, где необходимо было установить ссылки на MasterPage.

Итак, я думал, что просто добавлю эту строку ко всем моим страницам и сделаю это. Но когда я добавляю эту строку, я получаю ошибку компиляции:
‘object’ не содержит определения для ‘Master’

Эта ошибка исходит из файла designer.cs, связанного с ASPX-страницей, к которой я добавил объявление «MasterType» .

Я заставил перестроить файл конструктора, но это ничего не меняет. Я сравнивал содержимое главной ссылки в файлах конструктора между login.aspx(рабочий) и default.aspx(не работает), но они точно такие же.

Так как я действительно хотел бы заставить его работать, не добавляя объявление «MasterType» на каждую страницу, и поскольку это «исправление» все равно не работает, кто-нибудь знает, почему не было объявления «MasterType» на файл aspx вызывает ошибку парсера? Есть ли исправление для этого?

Пример кода:

Вот код для login.aspx и login.aspx.cs, который работает без ошибок:

Login.aspx

    <%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/MainMaster.master" AutoEventWireup="true" Inherits="SOME.NAMESPACE.MyApplicationName.WebApplication.Login" Codebehind="Login.aspx.cs" %>
<%@ MasterType VirtualPath="~/MasterPages/MainMaster.master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder" Runat="Server">
    <table>
    <tr>
        <td>
            <asp:UpdatePanel ID="upLogin" runat="server">
                <ContentTemplate>
                    <asp:Panel ID="Panel1" runat="server" DefaultButton="Login1$LoginButton">
                        <asp:Login ID="Login1" runat="server" LoginButtonStyle-CssClass="button" 
                        TextBoxStyle-CssClass="textBoxRequired" 
                        TitleTextStyle-CssClass="loginTitle"  >
                        </asp:Login>
                    </asp:Panel>
                </ContentTemplate>
            </asp:UpdatePanel>
            <asp:UpdatePanel ID="upPasswordRecovery" runat="server">
                <ContentTemplate>
                <asp:PasswordRecovery ID="PasswordRecovery1" runat="server" 
                SubmitButtonStyle-CssClass="button" TitleTextStyle-CssClass="loginTitle" 
                SuccessText="Your new password has been sent to you."
                UserNameInstructionText="Enter your User name to reset your password." />
                </ContentTemplate>
            </asp:UpdatePanel>
        </td>
    </tr>
    </table>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="SideBarPlaceHolder" Runat="Server">
    <h2>Login</h2>
    <asp:Button ID="btnCreateAccount" runat="server" Text="Create Account" OnClick="btnCreateAccount_Click" CausesValidation="false" />
</asp:Content>

Login.aspx.cs

    using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SOME.NAMESPACE.MyApplicationName.WebApplication;
using SOME.NAMESPACE.MyApplicationName.Bll;

namespace SOME.NAMESPACE.MyApplicationName.WebApplication
{
    public partial class Login : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Login1.Focus();
        }
        protected void btnCreateAccount_Click(object sender, EventArgs e)
        {
            Page.Response.Redirect("~/CreateUser/default.aspx");
        }
    } 
}

Вот код для default.aspx и default.aspx.cs, который бросает ошибку парсера при просмотре в веб-браузере:

Default.aspx

    <%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/MainMaster.master" AutoEventWireup="True" Inherits="SOME.NAMESPACE.MyApplicationName.WebApplication._Default" Codebehind="Default.aspx.cs" %>
<%@ MasterType VirtualPath="~/MasterPages/MainMaster.master" %>
<asp:Content ID="MainContent" ContentPlaceHolderID="ContentPlaceHolder" Runat="Server">
<div class="post">
    <h2 class="title">Announcements</h2>
    <p class="meta">Posted by Amanda Myer on December 15, 2009 at 10:55 AM</p>
    <div class="entry">
        <p>The MyApplicationName CMDB will be down for maintenance from 5:30 PM until 6:30 PM on Wednesday, December 15, 2009.</p>
    </div>
    <p class="meta">Posted by Amanda Myer on December 01, 2009 at 1:23 PM</p>
    <div class="entry">
        <p>The MyApplicationName CMDB is officially live and ready for use!</p>
    </div>
</div>
</asp:Content>
<asp:Content ID="SideBarContent" ContentPlaceHolderID="SideBarPlaceHolder" Runat="Server">
    <img src="images/MyApplicationName.jpg" alt="MyApplicationName Gremlin" width="250"/>
</asp:Content>

Default.aspx.cs

    using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using SOME.NAMESPACE.MyApplicationName.Bll;
using SOME.NAMESPACE.MyApplicationName.WebApplication;

public partial class _Default : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
}

Спасибо!

f7ed8ae85ec344278b80e2c35f189019.png


  • Вопрос задан

    более трёх лет назад

  • 1439 просмотров


1

комментарий


Решения вопроса 1

andrewpianykh

Соответствие пространств имен в Global.asax.cs и Global.asax проверьте. Должно быть GameStore.MvcApplication.

Пригласить эксперта


Ответы на вопрос 2

eRKa

@kttotto

пофиг на чем писать

У Вас в коде Codebehind, а в доках везде CodeBehind. Это может быть причиной?


Комментировать


Похожие вопросы


  • Показать ещё
    Загружается…

28 янв. 2023, в 16:38

2500 руб./за проект

28 янв. 2023, в 15:53

3000 руб./за проект

28 янв. 2023, в 15:40

5000 руб./за проект

Минуточку внимания

  • Remove From My Forums

none

Ошибка источника

  • Вопрос

  • Добрый день !

    У меня возникла такая проблема:

    после установки Visual Studio 2010 для ASP.NET MVC4  выдаетя:
    «Сообщение об ошибке синтаксического анализатора: Не удалось загрузить тип ‘My_MVC4.MvcApplication’.
    Ошибка источника:
    Строка 1:<%@ Application Codebehind=»Global.asax.cs» Inherits=»‘My_MVC4.MvcApplication» Language=»C#» %>

    Подскажите пожалуйста, как с этим бороться?

    Заранее благодарен, app.

Ответы

  • My_MVC4.MvcApplication — это ваш класс, определенный в global.asax.cs. Скорее всего у вас просто проект не скопмилирован.
    Запустите свой проект из студии по Ctrl+F5.

    • Помечено в качестве ответа

      8 октября 2012 г. 8:37

  • Привет.

    Нет, врядли дело в настройках. В каком браузере запускается у вас веб-приложение, помоему, только в IE можно отлаживать javascript из Visual Studio. В остальных браузерах — нужно пользоваться их встроенными утилитами для отладки.


    Для связи [mail]

    • Помечено в качестве ответа
      Abolmasov Dmitry
      8 октября 2012 г. 8:37

I’ve finished simple asp.net web application project, compiled it, and try to test on local IIS. I’ve create virtual directory, map it with physical directory, then put all necessary files there, including bin folder with all .dll’s
In the project settings, build section, output path is bin
So when i try to browse my app i got:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Parser Error 
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Could not load type 'AmeriaTestTask.Default'.

Source Error: 


Line 1:  <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AmeriaTestTask.Default" %>
Line 2:  
Line 3:  <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>


Source File: /virtual/default.aspx    Line: 1 

enter image description here

Have read similar problem posts and solution was to set output path to bin, but it is defalut for my project.

asked Feb 10, 2013 at 17:36

igorGIS's user avatar

9

I know i am too late to answer but it could help others and save time.

Following might be other solutions.

Solution 1: See Creating a Virtual Directory for Your Application for detailed instructions on creating a virtual directory for your application.

Solution 2: Your application’s Bin folder is missing or the application’s DLL file is missing. See Copying Your Application Files to a Production Server for detailed instructions.

Solution 3: You may have deployed to the web root folder, but have not changed some of the settings in the Web.config file. See Deploying to web root for detailed instructions.

In my case Solution 2 works, while deploying to server some DLL's from bin directory has not been uploaded to server successfully. I have re-upload all DLL’s again and it works!!

Here is the reference link to solve asp.net parser error.

answered Jan 23, 2014 at 8:46

immayankmodi's user avatar

immayankmodiimmayankmodi

7,8309 gold badges35 silver badges55 bronze badges

0

I had the same issue. Ran 5 or 6 hours of researches. A simple solution seems to be working. I just had to convert my folder to application from iis. It worked fine. (this was a scenario where I had done a migration from server 2003 to server 2008 R2)

(1) Open IIS and select the website and the appropriate folder that needs to be converted. Right-click and select Convert to Application.

enter image description here

answered Sep 13, 2014 at 6:20

Aravinda's user avatar

AravindaAravinda

4951 gold badge7 silver badges16 bronze badges

3

Try changing CodeBehind="Default.aspx.cs" to CodeFile="Default.aspx.cs"

answered Jun 16, 2016 at 6:39

Codeone's user avatar

CodeoneCodeone

1,1482 gold badges15 silver badges39 bronze badges

Sometimes it happens if you either:

  1. Clean solution/build or,
  2. Rebuild solution/build.

If it ‘suddenly’ happens after such, and your code has build-time errors then try fixing those errors first.

What happens is that as your solution is built, DLL files are created and stored in the projects bin folder. If there is an error in your code during build-time, the DLL files aren’t created properly which brings up an error.

A ‘quick fix’ would be to fix all your errors or comment them out (if they wont affect other web pages.) then rebuild project/solution

If this doesn’t work then try changing:
CodeBehind=»blahblahblah.aspx.cs»

to:
CodeFile=»blahblahblah.aspx.cs»

Note: Change «blahblahblah» to the pages real name.

answered Sep 14, 2017 at 15:00

Onga Leo-Yoda Vellem's user avatar

I have solved it this way.

Go to your project file let’s say project/name/bin and delete everything within the bin folder. (this will then give you another error which you can solve this way)

then in your visual studio right click project’s References folder, to open NuGet Package Manager.

Go to browse and install «DotNetCompilerPlatform».

answered Sep 19, 2018 at 9:15

Mo D Genesis's user avatar

Mo D GenesisMo D Genesis

4,5141 gold badge19 silver badges30 bronze badges

Faced the same error when I had a programming error in one of the ASHX files: it was created by copying another file, and inherited its class name in the code behind statement. There was no error when all ASPX and ASHX files ran in IIS Express locally, but once deployed to the server they stopped working (all of them).

Once I found that one ASHX page and fixed the class name to reflect its own class name, all ASPX and ASHX files started working fine in IIS.

answered Oct 5, 2016 at 16:17

ajeh's user avatar

ajehajeh

2,6002 gold badges31 silver badges61 bronze badges

Very old question here, but I ran into the same error and none of the provided answers solved the issue.

My issue occurred because I manually changed the namespace and assembly names of the project after initial creation. Took me a little bit to notice that the namespace in the Inherits attribute didn’t match the updated namespace.

Updating that namespace in the Global.asax markup to match the apps namespace fixed the error for me.

answered Oct 16, 2019 at 20:05

A-A-ron's user avatar

A-A-ronA-A-ron

5291 gold badge4 silver badges14 bronze badges

IIS 7 or IIS 8 or 8.5 version — if you are migrating from 2003 to 2012/2008 make sure web service are in application type instead virtual directory

answered Jul 31, 2015 at 9:53

Chandrashekar Gowda's user avatar

0

In my case, There were new code branch and old code branch was deployed locally in IIS. So it was pointing to old branch code that was not available. So i had deployed my code to IIS with new branch and it is working now.

answered Dec 27, 2017 at 14:02

Jeetendra's user avatar

0

In my case I missed the compile tag in the .csproj file

<Compile Include="Global.asax.cs">
  <DependentUpon>Global.asax</DependentUpon>
  <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>

answered Apr 30, 2018 at 10:24

David's user avatar

DavidDavid

69311 silver badges24 bronze badges

Interesting all the different scenarios..

In my case…I had uploaded my site to GoDaddy and was getting the Parser Error.

I resolved it by commenting out compilers under system.codedom in web.config.
And also add a custom profile for publishing that would precompile during publishing.

  <system.codedom>
    <!--GoDaddy does not compile!-->
    <!--<compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=&quot;Web&quot; /optionInfer+" />
    </compilers>-->
  </system.codedom>

answered Apr 4, 2019 at 23:54

Chris Catignani's user avatar

Chris CatignaniChris Catignani

4,75813 gold badges43 silver badges48 bronze badges

When you add subfolders and files in subfolders the DLL files in Bin folder also may have changed. When I uploaded the updated DLL file in Bin folder it solved the issue. Thanks to Mayank Modi who suggested that or hinted that.

answered Jul 31, 2019 at 5:32

Sam Patirage's user avatar

Looking at the error message, part of the code of your Default.aspx is :

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AmeriaTestTask.Default" %>

but AmeriaTestTask.Default does not exists, so you have to change it, most probably to the class defined in Default.aspx.cs. For example for web api aplications, the class defined in Global.asax.cs is : public class WebApiApplication : System.Web.HttpApplication and in the asax page you have :

<%@ Application Codebehind="Global.asax.cs" Inherits="MyProject.WebApiApplication" Language="C#" %>

answered Mar 22, 2020 at 15:08

Mario's user avatar

MarioMario

3132 silver badges11 bronze badges

I am too late but let me explain how I solved this problem.

This problem is basically because of improper folders/solution structure.

this issue may occur because
1. If you have copied project from other location and trying to run the project.

so to resolve this go to original location and crosscheck the folders and files again.

this works for me.

answered Sep 21, 2015 at 6:14

Shriganesh Kolhe's user avatar

After a lot of searching ,i found the problem was in my project dll file .i cleaned and rebuild my project when there were compilation errors …
simple solution is to remove all compilation errors in all pages either by removing contents or commenting lines ,then clean and rebuild your project …
this will sort out your problem ..

answered May 19, 2020 at 18:20

abhishek bhardwaj's user avatar

This happens when the files inside the Debug and Release folder are not created properly(Either they are having wrong reference or having overwritten many times). I have faced the same problem in which, i everything works fine when we build the solution, but when i publish the website it gives me same error.
I have solved this in following manner:

  1. Go to your Solution Explorer in Visual Studio and click on show hidden files (if they are not showing ! )
  2. you will find a folder named obj, open it .
  3. Here there are again 2 folder named respectively as Debug and Release.
    Now, delete the content from these two folder, Make sure that you do not delete the folders Debug and Release. Only delete the files and folders inside Debug and Release folder.
  4. Now build and publish your solution and everything will work like charm.

answered Sep 20, 2015 at 11:08

Roshan Parmar's user avatar

Roshan ParmarRoshan Parmar

3,6821 gold badge11 silver badges7 bronze badges

1

I’ve finished simple asp.net web application project, compiled it, and try to test on local IIS. I’ve create virtual directory, map it with physical directory, then put all necessary files there, including bin folder with all .dll’s
In the project settings, build section, output path is bin
So when i try to browse my app i got:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Parser Error 
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Could not load type 'AmeriaTestTask.Default'.

Source Error: 


Line 1:  <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AmeriaTestTask.Default" %>
Line 2:  
Line 3:  <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>


Source File: /virtual/default.aspx    Line: 1 

enter image description here

Have read similar problem posts and solution was to set output path to bin, but it is defalut for my project.

asked Feb 10, 2013 at 17:36

igorGIS's user avatar

9

I know i am too late to answer but it could help others and save time.

Following might be other solutions.

Solution 1: See Creating a Virtual Directory for Your Application for detailed instructions on creating a virtual directory for your application.

Solution 2: Your application’s Bin folder is missing or the application’s DLL file is missing. See Copying Your Application Files to a Production Server for detailed instructions.

Solution 3: You may have deployed to the web root folder, but have not changed some of the settings in the Web.config file. See Deploying to web root for detailed instructions.

In my case Solution 2 works, while deploying to server some DLL's from bin directory has not been uploaded to server successfully. I have re-upload all DLL’s again and it works!!

Here is the reference link to solve asp.net parser error.

answered Jan 23, 2014 at 8:46

immayankmodi's user avatar

immayankmodiimmayankmodi

7,8309 gold badges35 silver badges55 bronze badges

0

I had the same issue. Ran 5 or 6 hours of researches. A simple solution seems to be working. I just had to convert my folder to application from iis. It worked fine. (this was a scenario where I had done a migration from server 2003 to server 2008 R2)

(1) Open IIS and select the website and the appropriate folder that needs to be converted. Right-click and select Convert to Application.

enter image description here

answered Sep 13, 2014 at 6:20

Aravinda's user avatar

AravindaAravinda

4951 gold badge7 silver badges16 bronze badges

3

Try changing CodeBehind="Default.aspx.cs" to CodeFile="Default.aspx.cs"

answered Jun 16, 2016 at 6:39

Codeone's user avatar

CodeoneCodeone

1,1482 gold badges15 silver badges39 bronze badges

Sometimes it happens if you either:

  1. Clean solution/build or,
  2. Rebuild solution/build.

If it ‘suddenly’ happens after such, and your code has build-time errors then try fixing those errors first.

What happens is that as your solution is built, DLL files are created and stored in the projects bin folder. If there is an error in your code during build-time, the DLL files aren’t created properly which brings up an error.

A ‘quick fix’ would be to fix all your errors or comment them out (if they wont affect other web pages.) then rebuild project/solution

If this doesn’t work then try changing:
CodeBehind=»blahblahblah.aspx.cs»

to:
CodeFile=»blahblahblah.aspx.cs»

Note: Change «blahblahblah» to the pages real name.

answered Sep 14, 2017 at 15:00

Onga Leo-Yoda Vellem's user avatar

I have solved it this way.

Go to your project file let’s say project/name/bin and delete everything within the bin folder. (this will then give you another error which you can solve this way)

then in your visual studio right click project’s References folder, to open NuGet Package Manager.

Go to browse and install «DotNetCompilerPlatform».

answered Sep 19, 2018 at 9:15

Mo D Genesis's user avatar

Mo D GenesisMo D Genesis

4,5141 gold badge19 silver badges30 bronze badges

Faced the same error when I had a programming error in one of the ASHX files: it was created by copying another file, and inherited its class name in the code behind statement. There was no error when all ASPX and ASHX files ran in IIS Express locally, but once deployed to the server they stopped working (all of them).

Once I found that one ASHX page and fixed the class name to reflect its own class name, all ASPX and ASHX files started working fine in IIS.

answered Oct 5, 2016 at 16:17

ajeh's user avatar

ajehajeh

2,6002 gold badges31 silver badges61 bronze badges

Very old question here, but I ran into the same error and none of the provided answers solved the issue.

My issue occurred because I manually changed the namespace and assembly names of the project after initial creation. Took me a little bit to notice that the namespace in the Inherits attribute didn’t match the updated namespace.

Updating that namespace in the Global.asax markup to match the apps namespace fixed the error for me.

answered Oct 16, 2019 at 20:05

A-A-ron's user avatar

A-A-ronA-A-ron

5291 gold badge4 silver badges14 bronze badges

IIS 7 or IIS 8 or 8.5 version — if you are migrating from 2003 to 2012/2008 make sure web service are in application type instead virtual directory

answered Jul 31, 2015 at 9:53

Chandrashekar Gowda's user avatar

0

In my case, There were new code branch and old code branch was deployed locally in IIS. So it was pointing to old branch code that was not available. So i had deployed my code to IIS with new branch and it is working now.

answered Dec 27, 2017 at 14:02

Jeetendra's user avatar

0

In my case I missed the compile tag in the .csproj file

<Compile Include="Global.asax.cs">
  <DependentUpon>Global.asax</DependentUpon>
  <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>

answered Apr 30, 2018 at 10:24

David's user avatar

DavidDavid

69311 silver badges24 bronze badges

Interesting all the different scenarios..

In my case…I had uploaded my site to GoDaddy and was getting the Parser Error.

I resolved it by commenting out compilers under system.codedom in web.config.
And also add a custom profile for publishing that would precompile during publishing.

  <system.codedom>
    <!--GoDaddy does not compile!-->
    <!--<compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=&quot;Web&quot; /optionInfer+" />
    </compilers>-->
  </system.codedom>

answered Apr 4, 2019 at 23:54

Chris Catignani's user avatar

Chris CatignaniChris Catignani

4,75813 gold badges43 silver badges48 bronze badges

When you add subfolders and files in subfolders the DLL files in Bin folder also may have changed. When I uploaded the updated DLL file in Bin folder it solved the issue. Thanks to Mayank Modi who suggested that or hinted that.

answered Jul 31, 2019 at 5:32

Sam Patirage's user avatar

Looking at the error message, part of the code of your Default.aspx is :

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AmeriaTestTask.Default" %>

but AmeriaTestTask.Default does not exists, so you have to change it, most probably to the class defined in Default.aspx.cs. For example for web api aplications, the class defined in Global.asax.cs is : public class WebApiApplication : System.Web.HttpApplication and in the asax page you have :

<%@ Application Codebehind="Global.asax.cs" Inherits="MyProject.WebApiApplication" Language="C#" %>

answered Mar 22, 2020 at 15:08

Mario's user avatar

MarioMario

3132 silver badges11 bronze badges

I am too late but let me explain how I solved this problem.

This problem is basically because of improper folders/solution structure.

this issue may occur because
1. If you have copied project from other location and trying to run the project.

so to resolve this go to original location and crosscheck the folders and files again.

this works for me.

answered Sep 21, 2015 at 6:14

Shriganesh Kolhe's user avatar

After a lot of searching ,i found the problem was in my project dll file .i cleaned and rebuild my project when there were compilation errors …
simple solution is to remove all compilation errors in all pages either by removing contents or commenting lines ,then clean and rebuild your project …
this will sort out your problem ..

answered May 19, 2020 at 18:20

abhishek bhardwaj's user avatar

This happens when the files inside the Debug and Release folder are not created properly(Either they are having wrong reference or having overwritten many times). I have faced the same problem in which, i everything works fine when we build the solution, but when i publish the website it gives me same error.
I have solved this in following manner:

  1. Go to your Solution Explorer in Visual Studio and click on show hidden files (if they are not showing ! )
  2. you will find a folder named obj, open it .
  3. Here there are again 2 folder named respectively as Debug and Release.
    Now, delete the content from these two folder, Make sure that you do not delete the folders Debug and Release. Only delete the files and folders inside Debug and Release folder.
  4. Now build and publish your solution and everything will work like charm.

answered Sep 20, 2015 at 11:08

Roshan Parmar's user avatar

Roshan ParmarRoshan Parmar

3,6821 gold badge11 silver badges7 bronze badges

1

I am getting the following error on one of our production servers. Not sure why it is working on the DEV server?

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type ‘TestMvcApplication.MvcApplication’.

Source Error:

Line 1: <%@ Application Codebehind=»Global.asax.cs» Inherits=»TestMvcApplication.MvcApplication» Language=»C#» %>

Source File: /global.asax Line: 1

Not sure if anybody came across this error before and how it was solved, but I have reached the end.
Any help would be appreciated.

I also need to mention that this is the published code, so all is compiled.
Can there be something wrong with my compiler settings?

p.campbell's user avatar

p.campbell

97.4k67 gold badges255 silver badges319 bronze badges

asked Oct 21, 2009 at 5:07

Riaan Engelbrecht's user avatar

4

None of the other answers worked for me. I fixed my error by changing the web project’s output path. I had had it set to bindebug but the web project doesn’t work unless the output path is set to simply «bin»

Community's user avatar

answered Oct 13, 2011 at 18:16

Brian Leeming's user avatar

Brian LeemingBrian Leeming

11.5k8 gold badges30 silver badges52 bronze badges

10

I’ve had this a couple of times. It’s especially frustrating as it’s right off the bat, and the error message holds no clue as to what might be the issue.

To fix this, right click your project title, in this case «TestMvcApplication» and click build.

This forces the code to compile before you run it. Don’t ask me why, but this has been the solution 100% of the time for me.

answered Feb 12, 2010 at 14:39

Andy Copley's user avatar

7

I have found that when you are forced to use the Configuration Manager to run under x86 or anything other than the standard project «out of the box» settings, the IDE creates a bunch of sub directories under the bin folder for the web project.

Once this starts happening, if the Cassini server is running, then the project does not serve properly.

I fixed it by going into the Web Project properties -> Build settings and changing the Output Path to be bin

Then rebuild and all works as it should.

answered Nov 14, 2011 at 23:52

DamoDBear's user avatar

DamoDBearDamoDBear

2412 silver badges2 bronze badges

4

I tried all above solutions but no luck. Adding line <add assembly="*" /> to web.config fixed it for me. (You can also add to machine.config or root web.config file of the appropriate .NET framework version, I didn’t try it) Thanks to MS Support for solution.

answered Jun 13, 2011 at 18:27

Manish Jain's user avatar

Manish JainManish Jain

9,4695 gold badges39 silver badges44 bronze badges

2

After a long hard look I came accross the real issue here.

The assemblies were corrupted by the FTP client I used to upload the files to a hosted environmet.

I changed my FTP client and all is working as intended.

answered Oct 21, 2009 at 18:31

Riaan Engelbrecht's user avatar

0

I had the same problem: mine was because the web project had a platform target of x86. I was running on a 64-bit machine; other projects in the solution were set to 64-bit.

To check your settings, right click the project and choose Properties. On the Build tab, check the value of «Platform Target».

Also check your solution’s build configuration (Build menu > Configuration Manager) to check all your projects are being built to the same platform.

In both cases, make sure you check the settings both for debug and release mode — otherwise you’ll get it working on your machine but not when you deploy it!

answered Jan 13, 2011 at 10:47

teedyay's user avatar

teedyayteedyay

23.1k19 gold badges65 silver badges73 bronze badges

1

I had what looked like the same error. I tried many suggestions from many pages only to find out the problem was that I had the website set to the wrong version of .Net

No matter how many re-compiles or people saying ‘configuration problem’, nobody made the point that the .net version needed to be checked.

answered Aug 9, 2011 at 16:27

Carl Wright's user avatar

IT happens with me when I rename my project/solution.
Go to the folder of project in windows explorer (get out of VS).
Find and open the file Global (maybe you’ll find 2 files, open that dont have «.asax.cs» extension), and edit the line of error with correct path.
Good luck!

answered Nov 18, 2011 at 21:02

Paulo's user avatar

PauloPaulo

811 silver badge1 bronze badge

1

I experienced the exact same problem a couple of days ago — as far as I can tell it was an issue with a 64-bit IIS running a 32-bit web application. We changed our production server to 32-bit and this issue disappeared.

answered Dec 3, 2009 at 14:05

Jaco Pretorius's user avatar

Jaco PretoriusJaco Pretorius

24.7k11 gold badges60 silver badges93 bronze badges

Make sure your default namespace in the web project properties is the same as the namespace in the Global.asax.cs. I had modified the default namespace to make it a subnamespace, changing it back fixed this issue for me.

answered Apr 16, 2014 at 16:05

Ace Hyzer's user avatar

Ace HyzerAce Hyzer

3453 silver badges10 bronze badges

0

For completness sake I included what my issue was and how I solved it:

If your like me and have httphandlers via web.config and you have redirects from your global.asax.cs (maybe in Session_Start() ) like in my case you get this error if your startup project does not have a reference defined which points to the target where your httphandler is pointing!! (but you wont get build errors, just runtime errors)

So:

  1. Double check your web.config for any external items
  2. Double check your startup project has all the references it needs.

Cheers.

answered Apr 11, 2013 at 20:24

Chris's user avatar

ChrisChris

1,00015 silver badges25 bronze badges

1

The only time I have experienced this was when the MVC framework was not installed on the server. Could that be the case?

A missing Pages section in ViewsWeb.config could also be at fault.

Undo's user avatar

Undo

25.4k37 gold badges109 silver badges128 bronze badges

answered Oct 21, 2009 at 5:09

Daniel Elliott's user avatar

Daniel ElliottDaniel Elliott

22.5k10 gold badges63 silver badges82 bronze badges

2

I had the same error and none of your solutions helped. I think my problem was simply the name that I had chosen for the project. I had named my project ‘interface’ which when I got the parse error it said that it couldn’t load:

Line 1: <%@ Application Codebehind=»Global.asax.cs» Inherits=»@interface.MvcApplication» Language=»C#» %>

Where there was an ‘@’ sign for some reason. I am guessing the word ‘interface’ is reserved for something else and it added the @ symbol but that obviously broke something. I deleted the project and made a new one with a different name with no problems.

agf's user avatar

agf

167k42 gold badges282 silver badges234 bronze badges

answered Aug 12, 2011 at 16:26

Matt's user avatar

Here’s another one:

  1. I had been working on a web api project that was using localhost:12345.
  2. I checked out a different branch from source control containing the same project.
  3. I ran the project on the branch and got the error.
  4. I went to «Properties > Web > Project Url» and clicked «Create Virtual Directory»
  5. A dialog came up telling me that the url was mapped to a different directory (the directory for the original project).
  6. I clicked Okay and the virtual directory was remapped.
  7. The error went away.

I hope that helps someone somewhere :)

answered Mar 4, 2014 at 19:13

grahamesd's user avatar

grahamesdgrahamesd

4,6731 gold badge26 silver badges27 bronze badges

1

I had a lot of problems and errors to solve, some of the above answers helped, but what the final trick that made it work for me was: Go to your project, click properties.

Go to the Package/Publish Web tab and make sure the configuration is set to Release and Platform to All Platforms.

Last make sure that the «Items to deploy (applies to all deployment methods)» is set to «All files in this project folder»

It then worked fine for me.

answered Jul 13, 2011 at 14:20

Emiel Haeghebaert's user avatar

This issue is complicated because it’s easy to confuse the root cause with whatever the immediate cause happens to be.

In my case, the immediate cause was that the solution is configured to use NuGet Package Restore, but the server was not connected to the internet, so NuGet was unable to download the dependencies when building for the first time.

I believe the root cause is simply that the solution is unable to resolve dependencies correctly. It may be an incorrect path configuration, or the wrong version of an assembly, or conflicting assemblies, or a partial deployment. But in all cases, the error is simply saying that it can’t find the type specified in global.asax because it can’t build it.

answered Mar 4, 2013 at 19:47

shovavnik's user avatar

shovavnikshovavnik

2,8683 gold badges24 silver badges21 bronze badges

Make sure that the Namespace in the Global.asax file matches that in the Global.cs file i.e.

Global.asax: Some.Website.Webapplication

Global.cs: Some.Website (minus the ‘WebApplication’)

Jay Walker's user avatar

Jay Walker

4,6355 gold badges46 silver badges53 bronze badges

answered Aug 8, 2013 at 20:16

TheDaveJay's user avatar

TheDaveJayTheDaveJay

7436 silver badges11 bronze badges

I tried most of the above answers and they didn’t work. For some reason just closing and reopening VS fixed the problem for me.

answered Feb 4, 2016 at 20:43

Rochelle C's user avatar

Rochelle CRochelle C

8983 gold badges10 silver badges22 bronze badges

My issue was solved when I converted in IIS the physical folder that was containing the files to an application. Right click > convert to application.

mortb's user avatar

mortb

9,0413 gold badges25 silver badges42 bronze badges

answered Dec 10, 2014 at 20:55

jayt.dev's user avatar

jayt.devjayt.dev

9696 gold badges14 silver badges36 bronze badges

For me, it was because I had temporarily excluded the file from the project. I merely included it in back in the project and then it worked.

answered Jun 20, 2013 at 14:11

mstechnewbie's user avatar

1

In my case reference of System.Web.MVC was missing from my project. But after adding references issue was same so i checked properties of my Bin folder it was ReadOnly. Just after making it writable,everything working fine.

answered Nov 20, 2013 at 10:42

yashpal's user avatar

yashpalyashpal

3261 gold badge3 silver badges16 bronze badges

I was getting error because I deployed the application as a virtual directory and I was was getting parser error «could not load type» then I deployed the application as a web site and i was not getting that error again.

answered Mar 5, 2014 at 22:08

Riaz's user avatar

None of the other answers resolved this error for me.
I did find a solution that worked, which I suggest for those in the same situation:

  1. Close Visual Studio
  2. Browse to ProjectsyourProjectyourProject
  3. Rename Web.Debug.config and Web.Release.config
  4. Rebuild and run your application

ahsteele's user avatar

ahsteele

26k27 gold badges137 silver badges247 bronze badges

answered Jun 20, 2011 at 16:42

Charles Burns's user avatar

Charles BurnsCharles Burns

10.2k7 gold badges66 silver badges81 bronze badges

1

I never really did get to the bottom of what was causing it for me. I think somewhere I must have been missing some files. I got the error after publishing to a new server. Eventually I copied the site from working site. Then the site worked and so did further publishes to the new server.

answered Oct 14, 2011 at 14:57

Giles Roberts's user avatar

Giles RobertsGiles Roberts

6,2586 gold badges47 silver badges63 bronze badges

Follow these steps:

  1. Build
  2. Configuration Manager
  3. Put the AnyCPU project
  4. Back to generate
  5. Ready, after this just follow the same steps to pass it to x86 or x64

Jesse's user avatar

Jesse

8,4957 gold badges46 silver badges57 bronze badges

answered Apr 10, 2013 at 20:56

Ragdare's user avatar

For me, I had a DLL included with my project that had to be run in a 32-bit environment.

The server was configured to run the website in 32-bit mode, but I was not able to run the application on my 64-bit machine because the localhost folder had not been specified to run in 32-bit mode.

answered May 24, 2013 at 18:47

jp2code's user avatar

jp2codejp2code

26.2k40 gold badges154 silver badges268 bronze badges

I just had a similar problem.

The reason was that I was changing a file.aspx.c and had to do a clean rebuild. After that everything worked.

answered Oct 10, 2013 at 11:13

Fannar Örn Hermannsson's user avatar

My problem was that I was trying to create a ASPX web application in a subfolder of a folder that already had a web.config file, and

So I opened up the parent folder in Visual Studio as a Web Site (Open > Web Site) I was able to add a new item ASPX page that had no issue parsing/loading.

answered Dec 5, 2013 at 19:55

jamespgilbert's user avatar

For me, the problem was only on certain (long) links within the website and was tracked down to URLScan having the default configuration of a URL length limit of 260.

answered Dec 17, 2013 at 23:58

James's user avatar

JamesJames

613 bronze badges

I’ve had the same issue.
Try to:

Right click on the project and select Clean, then right click on it again and select Rebuild and run the project to see if it worked.

answered Jan 2, 2014 at 12:54

da Rocha Pires's user avatar

da Rocha Piresda Rocha Pires

2,4241 gold badge24 silver badges19 bronze badges

I am getting the following error on one of our production servers. Not sure why it is working on the DEV server?

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type ‘TestMvcApplication.MvcApplication’.

Source Error:

Line 1: <%@ Application Codebehind=»Global.asax.cs» Inherits=»TestMvcApplication.MvcApplication» Language=»C#» %>

Source File: /global.asax Line: 1

Not sure if anybody came across this error before and how it was solved, but I have reached the end.
Any help would be appreciated.

I also need to mention that this is the published code, so all is compiled.
Can there be something wrong with my compiler settings?

p.campbell's user avatar

p.campbell

97.4k67 gold badges255 silver badges319 bronze badges

asked Oct 21, 2009 at 5:07

Riaan Engelbrecht's user avatar

4

None of the other answers worked for me. I fixed my error by changing the web project’s output path. I had had it set to bindebug but the web project doesn’t work unless the output path is set to simply «bin»

Community's user avatar

answered Oct 13, 2011 at 18:16

Brian Leeming's user avatar

Brian LeemingBrian Leeming

11.5k8 gold badges30 silver badges52 bronze badges

10

I’ve had this a couple of times. It’s especially frustrating as it’s right off the bat, and the error message holds no clue as to what might be the issue.

To fix this, right click your project title, in this case «TestMvcApplication» and click build.

This forces the code to compile before you run it. Don’t ask me why, but this has been the solution 100% of the time for me.

answered Feb 12, 2010 at 14:39

Andy Copley's user avatar

7

I have found that when you are forced to use the Configuration Manager to run under x86 or anything other than the standard project «out of the box» settings, the IDE creates a bunch of sub directories under the bin folder for the web project.

Once this starts happening, if the Cassini server is running, then the project does not serve properly.

I fixed it by going into the Web Project properties -> Build settings and changing the Output Path to be bin

Then rebuild and all works as it should.

answered Nov 14, 2011 at 23:52

DamoDBear's user avatar

DamoDBearDamoDBear

2412 silver badges2 bronze badges

4

I tried all above solutions but no luck. Adding line <add assembly="*" /> to web.config fixed it for me. (You can also add to machine.config or root web.config file of the appropriate .NET framework version, I didn’t try it) Thanks to MS Support for solution.

answered Jun 13, 2011 at 18:27

Manish Jain's user avatar

Manish JainManish Jain

9,4695 gold badges39 silver badges44 bronze badges

2

After a long hard look I came accross the real issue here.

The assemblies were corrupted by the FTP client I used to upload the files to a hosted environmet.

I changed my FTP client and all is working as intended.

answered Oct 21, 2009 at 18:31

Riaan Engelbrecht's user avatar

0

I had the same problem: mine was because the web project had a platform target of x86. I was running on a 64-bit machine; other projects in the solution were set to 64-bit.

To check your settings, right click the project and choose Properties. On the Build tab, check the value of «Platform Target».

Also check your solution’s build configuration (Build menu > Configuration Manager) to check all your projects are being built to the same platform.

In both cases, make sure you check the settings both for debug and release mode — otherwise you’ll get it working on your machine but not when you deploy it!

answered Jan 13, 2011 at 10:47

teedyay's user avatar

teedyayteedyay

23.1k19 gold badges65 silver badges73 bronze badges

1

I had what looked like the same error. I tried many suggestions from many pages only to find out the problem was that I had the website set to the wrong version of .Net

No matter how many re-compiles or people saying ‘configuration problem’, nobody made the point that the .net version needed to be checked.

answered Aug 9, 2011 at 16:27

Carl Wright's user avatar

IT happens with me when I rename my project/solution.
Go to the folder of project in windows explorer (get out of VS).
Find and open the file Global (maybe you’ll find 2 files, open that dont have «.asax.cs» extension), and edit the line of error with correct path.
Good luck!

answered Nov 18, 2011 at 21:02

Paulo's user avatar

PauloPaulo

811 silver badge1 bronze badge

1

I experienced the exact same problem a couple of days ago — as far as I can tell it was an issue with a 64-bit IIS running a 32-bit web application. We changed our production server to 32-bit and this issue disappeared.

answered Dec 3, 2009 at 14:05

Jaco Pretorius's user avatar

Jaco PretoriusJaco Pretorius

24.7k11 gold badges60 silver badges93 bronze badges

Make sure your default namespace in the web project properties is the same as the namespace in the Global.asax.cs. I had modified the default namespace to make it a subnamespace, changing it back fixed this issue for me.

answered Apr 16, 2014 at 16:05

Ace Hyzer's user avatar

Ace HyzerAce Hyzer

3453 silver badges10 bronze badges

0

For completness sake I included what my issue was and how I solved it:

If your like me and have httphandlers via web.config and you have redirects from your global.asax.cs (maybe in Session_Start() ) like in my case you get this error if your startup project does not have a reference defined which points to the target where your httphandler is pointing!! (but you wont get build errors, just runtime errors)

So:

  1. Double check your web.config for any external items
  2. Double check your startup project has all the references it needs.

Cheers.

answered Apr 11, 2013 at 20:24

Chris's user avatar

ChrisChris

1,00015 silver badges25 bronze badges

1

The only time I have experienced this was when the MVC framework was not installed on the server. Could that be the case?

A missing Pages section in ViewsWeb.config could also be at fault.

Undo's user avatar

Undo

25.4k37 gold badges109 silver badges128 bronze badges

answered Oct 21, 2009 at 5:09

Daniel Elliott's user avatar

Daniel ElliottDaniel Elliott

22.5k10 gold badges63 silver badges82 bronze badges

2

I had the same error and none of your solutions helped. I think my problem was simply the name that I had chosen for the project. I had named my project ‘interface’ which when I got the parse error it said that it couldn’t load:

Line 1: <%@ Application Codebehind=»Global.asax.cs» Inherits=»@interface.MvcApplication» Language=»C#» %>

Where there was an ‘@’ sign for some reason. I am guessing the word ‘interface’ is reserved for something else and it added the @ symbol but that obviously broke something. I deleted the project and made a new one with a different name with no problems.

agf's user avatar

agf

167k42 gold badges282 silver badges234 bronze badges

answered Aug 12, 2011 at 16:26

Matt's user avatar

Here’s another one:

  1. I had been working on a web api project that was using localhost:12345.
  2. I checked out a different branch from source control containing the same project.
  3. I ran the project on the branch and got the error.
  4. I went to «Properties > Web > Project Url» and clicked «Create Virtual Directory»
  5. A dialog came up telling me that the url was mapped to a different directory (the directory for the original project).
  6. I clicked Okay and the virtual directory was remapped.
  7. The error went away.

I hope that helps someone somewhere :)

answered Mar 4, 2014 at 19:13

grahamesd's user avatar

grahamesdgrahamesd

4,6731 gold badge26 silver badges27 bronze badges

1

I had a lot of problems and errors to solve, some of the above answers helped, but what the final trick that made it work for me was: Go to your project, click properties.

Go to the Package/Publish Web tab and make sure the configuration is set to Release and Platform to All Platforms.

Last make sure that the «Items to deploy (applies to all deployment methods)» is set to «All files in this project folder»

It then worked fine for me.

answered Jul 13, 2011 at 14:20

Emiel Haeghebaert's user avatar

This issue is complicated because it’s easy to confuse the root cause with whatever the immediate cause happens to be.

In my case, the immediate cause was that the solution is configured to use NuGet Package Restore, but the server was not connected to the internet, so NuGet was unable to download the dependencies when building for the first time.

I believe the root cause is simply that the solution is unable to resolve dependencies correctly. It may be an incorrect path configuration, or the wrong version of an assembly, or conflicting assemblies, or a partial deployment. But in all cases, the error is simply saying that it can’t find the type specified in global.asax because it can’t build it.

answered Mar 4, 2013 at 19:47

shovavnik's user avatar

shovavnikshovavnik

2,8683 gold badges24 silver badges21 bronze badges

Make sure that the Namespace in the Global.asax file matches that in the Global.cs file i.e.

Global.asax: Some.Website.Webapplication

Global.cs: Some.Website (minus the ‘WebApplication’)

Jay Walker's user avatar

Jay Walker

4,6355 gold badges46 silver badges53 bronze badges

answered Aug 8, 2013 at 20:16

TheDaveJay's user avatar

TheDaveJayTheDaveJay

7436 silver badges11 bronze badges

I tried most of the above answers and they didn’t work. For some reason just closing and reopening VS fixed the problem for me.

answered Feb 4, 2016 at 20:43

Rochelle C's user avatar

Rochelle CRochelle C

8983 gold badges10 silver badges22 bronze badges

My issue was solved when I converted in IIS the physical folder that was containing the files to an application. Right click > convert to application.

mortb's user avatar

mortb

9,0413 gold badges25 silver badges42 bronze badges

answered Dec 10, 2014 at 20:55

jayt.dev's user avatar

jayt.devjayt.dev

9696 gold badges14 silver badges36 bronze badges

For me, it was because I had temporarily excluded the file from the project. I merely included it in back in the project and then it worked.

answered Jun 20, 2013 at 14:11

mstechnewbie's user avatar

1

In my case reference of System.Web.MVC was missing from my project. But after adding references issue was same so i checked properties of my Bin folder it was ReadOnly. Just after making it writable,everything working fine.

answered Nov 20, 2013 at 10:42

yashpal's user avatar

yashpalyashpal

3261 gold badge3 silver badges16 bronze badges

I was getting error because I deployed the application as a virtual directory and I was was getting parser error «could not load type» then I deployed the application as a web site and i was not getting that error again.

answered Mar 5, 2014 at 22:08

Riaz's user avatar

None of the other answers resolved this error for me.
I did find a solution that worked, which I suggest for those in the same situation:

  1. Close Visual Studio
  2. Browse to ProjectsyourProjectyourProject
  3. Rename Web.Debug.config and Web.Release.config
  4. Rebuild and run your application

ahsteele's user avatar

ahsteele

26k27 gold badges137 silver badges247 bronze badges

answered Jun 20, 2011 at 16:42

Charles Burns's user avatar

Charles BurnsCharles Burns

10.2k7 gold badges66 silver badges81 bronze badges

1

I never really did get to the bottom of what was causing it for me. I think somewhere I must have been missing some files. I got the error after publishing to a new server. Eventually I copied the site from working site. Then the site worked and so did further publishes to the new server.

answered Oct 14, 2011 at 14:57

Giles Roberts's user avatar

Giles RobertsGiles Roberts

6,2586 gold badges47 silver badges63 bronze badges

Follow these steps:

  1. Build
  2. Configuration Manager
  3. Put the AnyCPU project
  4. Back to generate
  5. Ready, after this just follow the same steps to pass it to x86 or x64

Jesse's user avatar

Jesse

8,4957 gold badges46 silver badges57 bronze badges

answered Apr 10, 2013 at 20:56

Ragdare's user avatar

For me, I had a DLL included with my project that had to be run in a 32-bit environment.

The server was configured to run the website in 32-bit mode, but I was not able to run the application on my 64-bit machine because the localhost folder had not been specified to run in 32-bit mode.

answered May 24, 2013 at 18:47

jp2code's user avatar

jp2codejp2code

26.2k40 gold badges154 silver badges268 bronze badges

I just had a similar problem.

The reason was that I was changing a file.aspx.c and had to do a clean rebuild. After that everything worked.

answered Oct 10, 2013 at 11:13

Fannar Örn Hermannsson's user avatar

My problem was that I was trying to create a ASPX web application in a subfolder of a folder that already had a web.config file, and

So I opened up the parent folder in Visual Studio as a Web Site (Open > Web Site) I was able to add a new item ASPX page that had no issue parsing/loading.

answered Dec 5, 2013 at 19:55

jamespgilbert's user avatar

For me, the problem was only on certain (long) links within the website and was tracked down to URLScan having the default configuration of a URL length limit of 260.

answered Dec 17, 2013 at 23:58

James's user avatar

JamesJames

613 bronze badges

I’ve had the same issue.
Try to:

Right click on the project and select Clean, then right click on it again and select Rebuild and run the project to see if it worked.

answered Jan 2, 2014 at 12:54

da Rocha Pires's user avatar

da Rocha Piresda Rocha Pires

2,4241 gold badge24 silver badges19 bronze badges

Я закончил простой проект веб-приложения asp.net, скомпилировал его и попытался протестировать на локальном IIS. Я создал виртуальный каталог, сопоставил его с физическим каталогом, затем поместил туда все необходимые файлы, включая папку bin со всеми .dll. В настройках проекта, раздел сборки, выходной путь — bin Итак, когда я пытаюсь просмотреть свое приложение, я получил :

Server Error in '/' Application.
--------------------------------------------------------------------------------

Parser Error 
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Could not load type 'AmeriaTestTask.Default'.

Source Error: 


Line 1:  <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AmeriaTestTask.Default" %>
Line 2:  
Line 3:  <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>


Source File: /virtual/default.aspx    Line: 1 

Введите описание изображения здесь

Прочитал похожие сообщения о проблемах, и решение состояло в том, чтобы установить выходной путь в bin, но это по умолчанию для моего проекта.

17 ответы

Я знаю, что слишком поздно, чтобы ответить, но это может помочь другим и сэкономить время.

Ниже могут быть другие решения.

Solution 1: Подробные инструкции по созданию виртуального каталога для вашего приложения см. в разделе Создание виртуального каталога для вашего приложения.

Solution 2: Папка Bin вашего приложения отсутствует или отсутствует DLL-файл приложения. Подробные инструкции см. в разделе Копирование файлов приложения на рабочий сервер.

Solution 3: Возможно, вы выполнили развертывание в корневой веб-папке, но не изменили некоторые параметры в файле Web.config. Подробные инструкции см. в разделе Развертывание в корневом каталоге.

В моем случае Solution 2 работает, при развертывании на сервере некоторых DLL's от bin каталог не был успешно загружен на сервер. У меня есть заново закачать все DLL и это работает !!

Вот реферальная ссылка на решить ошибку парсера asp.net.

Создан 18 сен.

Я была такая же проблема. Провел 5 или 6 часов исследований. Кажется, простое решение работает. Мне просто нужно было преобразовать мою папку в приложение из iis. Это работало нормально. (это был сценарий, когда я выполнил миграцию с сервера 2003 на сервер 2008 R2)

(1) Откройте IIS и выберите веб-сайт и соответствующую папку, которую необходимо преобразовать. Щелкните правой кнопкой мыши и выберите «Преобразовать в приложение».

Введите описание изображения здесь

ответ дан 20 авг.

Попробуйте изменить CodeBehind="Default.aspx.cs" в CodeFile="Default.aspx.cs"

Создан 16 июн.

Иногда это происходит, если вы либо:

  1. Чистое решение/сборка или,
  2. Перестроить решение/сборка.

Если это «внезапно» произойдет после этого, и ваш код строить-time, попробуйте сначала исправить эти ошибки.

Что происходит, так это то, что по мере создания вашего решения файлы DLL создаются и сохраняются в папке bin проектов. Если во время сборки в вашем коде возникает ошибка, файлы DLL создаются неправильно, что приводит к ошибке.

«Быстрое исправление» будет заключаться в том, чтобы исправить все ваши ошибки или закомментировать их (если они не повлияют на другие веб-страницы), а затем перестроить проект/решение.

Если это не работает, попробуйте изменить:
CodeBehind=»blahblahblah.aspx.cs»

чтобы:
CodeFile=»blahblahblah.aspx.cs»

Примечание. Измените «blahblahblah» на настоящее имя страницы.

Создан 23 фев.

Создан 10 фев.

Я решил это так.

Перейдите к файлу проекта, скажем, project/name/bin и удалите все в папке bin. (это даст вам еще одну ошибку, которую вы можете решить таким образом)

затем в вашей визуальной студии щелкните правой кнопкой мыши папку проекта «Ссылки», чтобы открыть диспетчер пакетов NuGet.

Перейдите к просмотру и установке «DotNetCompilerPlatform».

Создан 19 сен.

Столкнулся с той же ошибкой, когда у меня была ошибка программирования в одном из файлов ASHX: он был создан путем копирования другого файла и унаследовал имя своего класса в операторе кода позади. Не было ошибки, когда все файлы ASPX и ASHX запускались в IIS Express локально, но после развертывания на сервере они перестали работать (все).

Как только я нашел эту страницу ASHX и исправил имя класса, чтобы оно отражало его собственное имя класса, все файлы ASPX и ASHX начали нормально работать в IIS.

ответ дан 05 окт ’16, 17:10

Здесь очень старый вопрос, но я столкнулся с той же ошибкой, и ни один из предоставленных ответов не решил проблему.

Моя проблема возникла из-за того, что я вручную изменил пространство имен и имена сборок проекта после первоначального создания. Мне потребовалось немного времени, чтобы заметить, что пространство имен в Inherits атрибут не соответствует обновленному пространству имен.

Обновление этого пространства имен в разметке Global.asax для соответствия пространству имен приложений исправило ошибку для меня.

ответ дан 16 окт ’19, 21:10

Версия IIS 7 или IIS 8 или 8.5 — если вы переходите с 2003 на 2012/2008, убедитесь, что веб-служба относится к типу приложения, а не к виртуальному каталогу.

Создан 31 июля ’15, 10:07

В моем случае была новая ветвь кода, а старая ветвь кода была развернута локально в IIS. Таким образом, он указывал на старый код ветки, который был недоступен. Итак, я развернул свой код в IIS с новой веткой, и теперь он работает.

ответ дан 27 дек ’17, 14:12

В моем случае я пропустил тег компиляции в файле .csproj.

<Compile Include="Global.asax.cs">
  <DependentUpon>Global.asax</DependentUpon>
  <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>

ответ дан 30 апр.

Интересны разные сценарии..

В моем случае… я загрузил свой сайт в GoDaddy и получил ошибку парсера.

Я решил это, закомментировав compilers под system.codedom в веб.конфигурации. А также добавить настраиваемый профиль для публикации, который бы прекомпилировался во время публикации.

  <system.codedom>
    <!--GoDaddy does not compile!-->
    <!--<compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=&quot;Web&quot; /optionInfer+" />
    </compilers>-->
  </system.codedom>

ответ дан 05 апр.

Когда вы добавляете вложенные папки и файлы в подпапки, файлы DLL в папке Bin также могут измениться. Когда я загрузил обновленный файл DLL в папку Bin, проблема решилась. Спасибо Mayank Modi, который предложил это или намекнул на это.

Создан 31 июля ’19, 06:07

Глядя на сообщение об ошибке, часть кода вашего Default.aspx является :

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AmeriaTestTask.Default" %>

но AmeriaTestTask.Default не существует, поэтому его необходимо изменить, скорее всего, на класс, определенный в Default.aspx.cs. Например, для приложений веб-API класс, определенный в Global.asax.cs: public class WebApiApplication : System.Web.HttpApplication и на странице asax у вас есть:

<%@ Application Codebehind="Global.asax.cs" Inherits="MyProject.WebApiApplication" Language="C#" %>

ответ дан 22 мар ’20, в 15:03

Я слишком поздно, но позвольте мне объяснить, как я решил эту проблему.

Эта проблема в основном из-за неправильной структуры папок/решений.

эта проблема может возникнуть из-за того, что 1. Если вы скопировали проект из другого места и пытаетесь запустить проект.

поэтому, чтобы решить эту проблему, перейдите в исходное местоположение и снова проверьте папки и файлы.

это работает для меня.

Создан 21 сен.

После долгих поисков,я обнаружил, что проблема была в файле dll моего проекта. Я очистил и перестроил свой проект, когда были ошибки компиляции …
Простое решение состоит в том, чтобы удалить все ошибки компиляции на всех страницах, либо удалив содержимое, либо строки комментариев, затем очистив и перестроив проект… это решит вашу проблему..

ответ дан 19 мая ’20, 19:05

Это происходит, когда файлы в папке «Отладка и выпуск» не созданы должным образом (либо они имеют неправильную ссылку, либо перезаписываются много раз). Я столкнулся с той же проблемой, когда все работает нормально, когда мы создаем решение, но когда я публикую веб-сайт, он дает мне ту же ошибку. Я решил это следующим образом:

  1. Перейдите в обозреватель решений в Visual Studio и нажмите «Показать скрытые файлы» (если они не отображаются!)
  2. вы найдете папку с именем obj, откройте ее.
  3. Здесь снова есть 2 папки с именами соответственно Debug и Release. Теперь удалите содержимое из этих двух папок. Убедитесь, что вы не удалили папки Debug и Release. Удаляйте только файлы и папки внутри папки Debug and Release.
  4. Теперь создайте и опубликуйте свое решение, и все будет работать как часы.

Создан 20 сен.

Не тот ответ, который вы ищете? Просмотрите другие вопросы с метками

asp.net
parsing
deployment

or задайте свой вопрос.

Hey I am getting the following error

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type ‘_AddToCart’.

Source Error:

Line 1:  <%@ Page Language="C#" AutoEventWireup="true" Codebehind="AddToCart.aspx.cs" Inherits="_AddToCart" Title="Untitled Page" %>
Line 2:  
Line 3:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


Source File: /FSAICart/AddToCart.aspx    Line: 1 

Where I do have the matching code behind file which is defined as follows

    using System;
  public partial class _AddToCart : System.Web.UI.Page {

Any Ideas ?

Muhammad Akhtar's user avatar

asked Jun 2, 2011 at 10:25

StevieB's user avatar

3

Try changing CodeBehind:

<%@ Page Language="C#"
AutoEventWireup="true"
**Codebehind**="AddToCart.aspx.cs"
Inherits="_AddToCart" Title="Untitled
Page" %>

To CodeFile:

<%@ Page Language="C#"
AutoEventWireup="true"
**CodeFile**="AddToCart.aspx.cs"
Inherits="_AddToCart" Title="Untitled
Page" %>

ASP .NET 1.1 used CodeBehind for compiling code in a separate file. ASP .NET 2.0 introduced the CodeFile syntax for compilation of partial classes.

See here for a more detailed explanation.

Lingnik's user avatar

answered Jun 2, 2011 at 13:25

Phaedrus's user avatar

PhaedrusPhaedrus

8,31126 silver badges28 bronze badges

0

Specify the namespace of the Inherits property of Page directive

Look at codebehind of your page. It looks like:

namespace MyWebSite
{
     public partial class _AddToCart : System.Web.UI.Page 
     {
        //...
     }           
}

So you must change Page directive to:

<%@ Page Language="C#" AutoEventWireup="true" Codebehind="AddToCart.aspx.cs" Inherits="MyWebSite._AddToCart" Title="Untitled Page" %>

Drew Gaynor's user avatar

Drew Gaynor

8,1465 gold badges39 silver badges52 bronze badges

answered Jun 2, 2011 at 10:29

Yuriy Rozhovetskiy's user avatar

1


Форум программистов Vingrad

Модераторы: gambit

Поиск:

Ответ в темуСоздание новой темы
Создание опроса
> Ошибка синтаксического анализатора (веб-служба) 

V

Опции темы

akizelokro

Крокодил
**

Профиль
Группа: Участник
Сообщений: 761
Регистрация: 30.7.2007

Репутация: нет
Всего: 5

Написал веб-службу. В Visual Studio работает. Поставил IIS, создал виртуальный каталог, закопировал туда «всё», получаю комментарий:

Цитата
Ошибка синтаксического анализатора 
Описание: Ошибка при разборе ресурса, требуемого для обслуживания этого запроса. Изучите следующие подробные сведения о данной ошибке разбора и измените исходный файл. 

Сообщение об ошибке синтаксического анализатора: Не удалось создать тип ‘WebServiceAgent.Service1’.

Ошибка источника: 

Строка 1:  <%@ WebService Language=»C#» CodeBehind=»Service1.asmx.cs» Class=»WebServiceAgent.Service1″ %>

 Исходный файл: /servi/Service1.asmx    Строка: 1 

Вроде все сделал, как требовалось. aspnet_regiis -i прописал. Виртуальный каталог — опции по умолчанию. 

Это сообщение отредактировал(а) akizelokro — 4.8.2008, 12:16

———————

a = a + b; b = a — b; a = a — b;

mr.DUDA

3D-маньяк
****

Профиль
Группа: Экс. модератор
Сообщений: 8244
Регистрация: 27.7.2003
Где: город-герой Минск

Репутация: 5
Всего: 232

Длл-ку скопировали в bin? Класс WebServiceAgent.Service1 там есть и так и называется?

———————

user posted image

akizelokro

Крокодил
**

Профиль
Группа: Участник
Сообщений: 761
Регистрация: 30.7.2007

Репутация: нет
Всего: 5

Где bin надо делать? В виртуальном каталоге?

Понял. Это что, получается, мне в IIS обязательно каталог bin создавать?

Это сообщение отредактировал(а) akizelokro — 5.8.2008, 12:19

———————

a = a + b; b = a — b; a = a — b;

Kosten

Новичок

Профиль
Группа: Участник
Сообщений: 45
Регистрация: 30.6.2003
Где: Cанкт-Петербург

Репутация: нет
Всего: нет

akizelokro, а ты ручками копировал на IIS?

Idsa

Эксперт
****

Профиль
Группа: Участник
Сообщений: 2086
Регистрация: 5.12.2006
Где: Томск

Репутация: 15
Всего: 62

Цитата(akizelokro @  5.8.2008,  15:09 Найти цитируемый пост)
Это что, получается, мне в IIS обязательно каталог bin создавать?

Все, что нужно, — положить в виртуальный каталог сборку из каталога bin.

———————

Мой блог: alexidsa.blogspot.com

mr.DUDA

3D-маньяк
****

Профиль
Группа: Экс. модератор
Сообщений: 8244
Регистрация: 27.7.2003
Где: город-герой Минск

Репутация: 5
Всего: 232

Цитата(akizelokro @  5.8.2008,  11:09 Найти цитируемый пост)
Понял. Это что, получается, мне в IIS обязательно каталог bin создавать?

В виртуальной директории лежит .asmx файл, а во вложенной директории bin будет dll-ка. Если просто .asmx скопировать — никакого веб-сервиса из воздуха не материализуется.  smile 

———————

user posted image

v_enom

Шустрый
*

Профиль
Группа: Участник
Сообщений: 101
Регистрация: 11.10.2006

Репутация: нет
Всего: нет

народ, помогите, такая же трабла, но я все перенес в каталог.

каталог находится по адресу:

C:CodeTestHelloWS

в нем лежат      ….bin  WebService1.dll    и  WebService1.pdb
                              Service1.asmx
                              Service1.asmx.cs

есди запускать код из файла Service1.asmx, то все работает, а если с кодбехайнд и прикрепить Service1.asmx.cs то выдается такая же ошибка 
(  
 Ошибка синтаксического анализатора
Описание: Ошибка при разборе ресурса, требуемого для обслуживания этого запроса. Изучите следующие подробные сведения о данной ошибке разбора и измените исходный файл.

Сообщение об ошибке синтаксического анализатора: Не удалось создать тип ‘WebService1.Service1’.

Ошибка источника:

Строка 1:  <%@ WebService Language=»C#» CodeBehind=»Service1.asmx.cs» Class=»WebService1.Service1″ %>

)

вот что у меня в файле .asmx.cs

Код

using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;

namespace WebService1
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://localhost")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    public class Service1 : System.Web.Services.WebService
    {

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }

        [WebMethod]
        public string ReversString(string MyMessage)
        {

            char[] arr = MyMessage.ToCharArray();
            Array.Reverse(arr);
            MyMessage = new string(arr);
            return MyMessage;

        }
    }
}

IIS 6.0, только поставил, особых настроек не делал. Только asp.net подключил и все….

Это сообщение отредактировал(а) v_enom — 17.9.2009, 16:04

v_enom

Шустрый
*

Профиль
Группа: Участник
Сообщений: 101
Регистрация: 11.10.2006

Репутация: нет
Всего: нет

решил эту проблему сперва развернув проект автоматически:

1. Создал простой проект web site service application 
2. Затем проект-свойства-web
3. прописал путь под галочкой use local IIS server 

Код

[URL=http://localhost:4000/WebService/WebService2]

и создал виртуальный каталог
user posted image

при этом у меня уже был зарегистрирован один веб-сервис — webService.
Т.е. когда я открыл IIS manager то увидел, что WebService2 прописан был как сервис внутри webService, а внутри него (webService2) уже был файл *.asmx
ранее я делал неправильно и внутри сервиса webService создавал папку, куда кидал *.asmx, *.asmx.cs и bin. Это не правильно, это ошибка и так не работает.

А вообще лучше переносить на IIS все автоматически. 

user posted image

при этом надо не забыть зарегистрировать asp.net в IIS через консольную команду «aspnet_regiis.exe -i»  в папке C:WINDOWSMicrosoft.NETFrameworkv2.0.50727 ,  выставить ASP.net 2.0 в свойствах сервиса,  
и еще в IIS manager в свойствах веб узла(и всех сервисов в т.ч.) Свойства-безопасность каталога-изменить надо поставить галочку «встроенная проверка подлинности Windows»

Это сообщение отредактировал(а) v_enom — 18.9.2009, 11:15



















Прежде чем создать тему, посмотрите сюда:
Любитель

Mymik

mr.DUDA

  • Что же такое .NET? Краткое описание, изучаем.
  • Какой язык программирования выбрать? выбираем.
  • C#. С чего начать? начинаем.
  • Обзор новых возможностей VS 2005, интересуемся.
  • Защита исходного кода .NET приложений, защищаем.
  • Литература по .NET, обращаемся.
  • Вопросы по .NET можно задать также в разделах: VB.NET, Delphi.NET.

  • FAQ раздела, ищем здесь.
  • Архиполезные ссылки: www.connectionstrings.com, www.pinvoke.net, www.codeproject.com

Используйте теги [code=csharp][/code] для подсветки кода. Используйтe чекбокс «транслит» если у Вас нет русских шрифтов.


Если Вам понравилась атмосфера форума, заходите к нам чаще! С уважением, Любитель, Mymik, mr.DUDA.

0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | Разработка под ASP.NET | Следующая тема »

Возможно, вам также будет интересно:

  • Asp net core 404 ошибка
  • Asmmap64 sys как исправить ошибку
  • Asl ошибка рендж ровер
  • Asko сушильная машина ошибка f10
  • Asko посудомоечная машина ошибка f11

  • Понравилась статья? Поделить с друзьями:
    0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии