2

I have a web service and it uses some other projects dll files. Everything is ok when it runs on my lochal server. But when I deploy to server, I have this error.

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 create type 'Dos.Service.Web.WS.DosMainWebService'.

Source Error:

Line 1: <%@ WebService Language="C#" CodeBehind="DosMainWebService.asmx.cs" Class="Dos.Service.Web.WS.DosMainWebService" %>

Source File: /ws/WS/DosMainWebService.asmx Line: 1

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272

John Saunders
  • 160,644
  • 26
  • 247
  • 397
cagin
  • 5,772
  • 14
  • 74
  • 130
  • Have you copied all the files? Looks to me like you are missing the .cs – ChrisBint Jul 05 '12 at 15:22
  • 2
    Does the `DosMainWebService.asmx.cs` code behind file exist in the correct location on the server? Does it define a class called `DosMainWebService`, and is that class defined ion the `Dos.Service.Web.WS` namespace? – Steven Doggart Jul 05 '12 at 15:24
  • @Chris, I checked but .cs file is in server. – cagin Jul 05 '12 at 15:53
  • ASMX is a legacy technology, and should not be used for new development. WCF or ASP.NET Web API should be used for all new development of web service clients and servers. One hint: Microsoft has retired the [ASMX Forum](http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/threads) on MSDN. – John Saunders Dec 20 '13 at 06:53

5 Answers5

4

I had the same error...

I solved it by changing the properties of my Xzy.asmx file:

  • Set Build Action to Content
  • Set Copy to Output Directory to Copy if newer (in my case it was set to "Do not copy")

I hope this helps anyone...

Rico Suter
  • 11,548
  • 6
  • 67
  • 93
  • Set Copy to Output Directory to Copy if newer (in my case it was set to "Do not copy") –  Jan 26 '18 at 16:06
1

Please make sure you deploy the WebService bin folder to the server. I believe it is missing your webservice dlls.

Cinchoo
  • 6,088
  • 2
  • 19
  • 34
1

I think you first of all check namespace asmx.cs same asmx

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
0

I believe you have one solution file with webservice and other class libraries and the webservice app consumes the dll from these class libraries. I can see one problem is probably you're using project type as website for webservice which creates problem while resolving type issue for webservice namespace. so the solution would be create a new solution as web application project type and then add the project libraries and it should resolve your issue.

mvm_bgm
  • 153
  • 1
  • 11
0

after testing many suggested solutions on the web all the issue was:

every time I was publishing only web service.asmx file

but after republish all the solution it works..because webservice.asmx has its own dll files

Sulyman
  • 440
  • 5
  • 14